Populating Datagrids??

  • Thread starter Thread starter Darryn Ross
  • Start date Start date
D

Darryn Ross

Hi,

When i popualte my datagrid the columns are all squashed together and not applying their set width.. my code is as follows..

first i do this..

DataGridTableStyle TSCA = new DataGridTableStyle() ;
TSCA.MappingName = "tbl" ;

DataGridColumnStyle TCCode = new DataGridTextBoxColumn() ;
TCCode.MappingName = "Code" ;
TCCode.HeaderText = "Code" ;
TCCode.Width = 11 ;
TSCA.GridColumnStyles.Add(TCCode) ;

dgCA.TableStyles.Add(TSCA) ;

then i do this...

CConnection.ConnectionString = StrConnectionPath ;
CConnection.Open() ;

SelectLstCommand.CommandText = "Select * From tbl" ;
SelectLstCommand.Connection = CConnection ;
CAdapter.SelectCommand = SelectLstCommand ;
CAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey ;
CAdapter.Fill(CDs, "tbl") ;
dgCA.SetDataBinding(CDs, "tbl") ;
CConnection.Close() ;

Any help would be appreciated.

Regards
Darryn
 
Back
Top