Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

code check please

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
guy - 25 Oct 2004 17:11 GMT
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
Ken Tucker [MVP] - 25 Oct 2004 19:47 GMT
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
Dennis - 26 Oct 2004 00:05 GMT
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.

> 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
[quoted text clipped - 21 lines]
>
> guy
guy - 26 Oct 2004 12:57 GMT
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
[quoted text clipped - 21 lines]
>
> guy

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.