code check please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am binding a datatable to a WinForms grid control but for some reason the
GridTableStyle is being ignored, the data just displays as if no TableStyle
was set up

I have also tried changing the DataTable TableName in code before the code
below - no effect.
The data displayed is correct, just the formatting is wrong

SubAreasAtDate is a DataTable and dgLicensedBlocks is the data grid

hear are the two lines:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName

I have also tried:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles.Clear()
dgLicensedBlocks.TableStyles.Add(Me.DataGridTableStyle2)
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName

Equivalent code works fine on 8 other datagrids in the app.

any ideas?

guy
 
Hi,

The little code you show looks ok. Are you sure you are loading the
right tablestyle?

Ken
---------------
I am binding a datatable to a WinForms grid control but for some reason the
GridTableStyle is being ignored, the data just displays as if no TableStyle
was set up

I have also tried changing the DataTable TableName in code before the code
below - no effect.
The data displayed is correct, just the formatting is wrong

SubAreasAtDate is a DataTable and dgLicensedBlocks is the data grid

hear are the two lines:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName

I have also tried:-
dgLicensedBlocks.DataSource = SubAreasAtDate
dgLicensedBlocks.TableStyles.Clear()
dgLicensedBlocks.TableStyles.Add(Me.DataGridTableStyle2)
dgLicensedBlocks.TableStyles(0).MappingName = SubAreasAtDate.TableName

Equivalent code works fine on 8 other datagrids in the app.

any ideas?

guy
 
Have you checked the mappnig names of your DataGridColumnStyles to be sure
they reflect the names of fields in the DataTable? You didn't show your code
for setting up these and adding them to the TableStyle Collection.
 
Thanks all,
i put a handler on the mappingname changed event and found another bit of
code was butting in and changing it

guy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top