PC Review


Reply
Thread Tools Rate Thread

code check please

 
 
=?Utf-8?B?Z3V5?=
Guest
Posts: n/a
 
      25th Oct 2004
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
 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      25th Oct 2004
Hi,

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

Ken
---------------
"guy" <(E-Mail Removed)> wrote in message
news:4C25B4D8-B6E3-43B2-AA00-(E-Mail Removed)...
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


 
Reply With Quote
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      26th Oct 2004
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.

"guy" wrote:

> 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

 
Reply With Quote
 
=?Utf-8?B?Z3V5?=
Guest
Posts: n/a
 
      26th Oct 2004
Thanks all,
i put a handler on the mappingname changed event and found another bit of
code was butting in and changing it

guy


> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Check Code Please Gina Whipp Microsoft Access Form Coding 1 29th Jan 2010 07:31 PM
Can I Check Out and Check In files from VSS through .NET Code? =?Utf-8?B?SW1heWFrdW1hcg==?= Microsoft Dot NET 2 11th Feb 2005 02:40 PM
If IsNull Check Number Stop Code, What is wrong with this code ? Dave Elliott Microsoft Access Forms 1 21st Dec 2003 03:49 PM
Please help to check code Richard Microsoft Access Forms 3 21st Nov 2003 02:26 AM
Help to check code Richard Microsoft Access Forms 3 18th Oct 2003 03:31 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:16 PM.