Click here to Skip to main content
15,908,274 members
Home / Discussions / C#
   

C#

 
GeneralRe: GDI GradientFill Pin
Mathew Hall15-Mar-05 17:10
Mathew Hall15-Mar-05 17:10 
Generali want to know something Pin
snouto15-Mar-05 12:32
snouto15-Mar-05 12:32 
GeneralRe: i want to know something Pin
Christian Graus15-Mar-05 12:57
protectorChristian Graus15-Mar-05 12:57 
GeneralUsing the update command of the datagrid to alter the data in a dataset Pin
Anonymous15-Mar-05 12:18
Anonymous15-Mar-05 12:18 
GeneralReceiving SMS problem Pin
ccui15-Mar-05 10:18
ccui15-Mar-05 10:18 
GeneralDataGrid TableStyles Pin
dennista15-Mar-05 9:03
dennista15-Mar-05 9:03 
GeneralRe: DataGrid TableStyles Pin
Kodanda Pani15-Mar-05 18:06
Kodanda Pani15-Mar-05 18:06 
GeneralRe: DataGrid TableStyles Pin
dennista16-Mar-05 3:31
dennista16-Mar-05 3:31 
Thanks for your reply Kodanda.

I tried your code. Here are the results:

I wasn't sure whether you wanted me to use the above code with all my designer settings still in place or use the above code instead of setting everything up through the designer. If I kept my settings in place, the additional TableStyle you create in your code never gets used. But if I remove my settings, it appears there is no mechanism in the above code to attach ColumnStyles to the TableStyle before accessing the ColumnStyles. I tried both ways.

If I added the code above with everything set up in the designer as I had before (i.e. my TableStyle and all ColumnStyles still set up) I was able to access 3 GridColumnStyle indices (0, 1, and 2). This, I assume, is because I set up 3 ColumnStyles via the designer. If I tried to access a fourth index (there are actually 5 fields in the dataset) I got an array out of bounds exception. When I run the code, the Console.WriteLine tells me there are 3 ColumnStyles. All of this makes sense to me. But the grid still appears in my form (both in the designer and at runtime) with all 5 columns from the dataset (instead of just the 3 I set up ColumnStyles for) and the default header names and widths.

If I removed my designer-created TableStyle and ColumnStyles and tried to use your code in its place, I got an array out of bounds exception at the access of GridColumnStyles[0] as I figured I would since there didn't seem to be any mechanism for attaching the ColumnStyles to the TableStyle. The only way I could find to attach them was basically using the same code the designer had used when it hooked up my visual settings. And the result was the same - the grid showed all 5 columns with default widths and heading names.

I am at a loss. Everything appears to be set up properly. I even looked through the designer-generated code and everything made sense. But somehow the grid is not displaying the way it's set up to. When I originally had the grid hooked up to an actual table for a datasource (instead of the Customer_CustomerNotes relation) my TableStyle and ColumnStyles seemed to work. Is there an issue with these working if you hook the grid up to a data relation instead of a data table? Or am I just missing something?


Thanks again,
Dennis
GeneralFile IO in Webservice gives Error Pin
James Poulose15-Mar-05 8:21
James Poulose15-Mar-05 8:21 
GeneralRe: File IO in Webservice gives Error Pin
TylerBrinks15-Mar-05 9:46
TylerBrinks15-Mar-05 9:46 
QuestionHow to create a shallow copy of List<T> ? Pin
Andres Coder15-Mar-05 7:50
Andres Coder15-Mar-05 7:50 
AnswerRe: How to create a shallow copy of List<T> ? Pin
leppie15-Mar-05 8:51
leppie15-Mar-05 8:51 
GeneralSending a web form as parameter Pin
see0715-Mar-05 7:45
see0715-Mar-05 7:45 
GeneralRe: Sending a web form as parameter Pin
Pushkar Pathak15-Mar-05 18:16
Pushkar Pathak15-Mar-05 18:16 
GeneralRe: Sending a web form as parameter Pin
see0716-Mar-05 11:59
see0716-Mar-05 11:59 
GeneralRe: Sending a web form as parameter Pin
see0722-Mar-05 7:00
see0722-Mar-05 7:00 
GeneralRe: Sending a web form as parameter Pin
see0722-Mar-05 12:20
see0722-Mar-05 12:20 
GeneralSystem.Timers problem Pin
sjhart15-Mar-05 7:17
sjhart15-Mar-05 7:17 
GeneralRe: System.Timers problem Pin
TylerBrinks15-Mar-05 8:20
TylerBrinks15-Mar-05 8:20 
GeneralPassing Safearray parameter to WebBrowser COM component Pin
simcho9915-Mar-05 3:45
simcho9915-Mar-05 3:45 
QuestionHow to show a child form when parent form is busy? Pin
oohungoo15-Mar-05 3:25
oohungoo15-Mar-05 3:25 
AnswerRe: How to show a child form when parent form is busy? Pin
tdciDoug15-Mar-05 4:22
tdciDoug15-Mar-05 4:22 
GeneralRe: How to show a child form when parent form is busy? Pin
oohungoo15-Mar-05 19:18
oohungoo15-Mar-05 19:18 
AnswerRe: How to show a child form when parent form is busy? Pin
James Poulose15-Mar-05 8:24
James Poulose15-Mar-05 8:24 
GeneralPivot table in .net Pin
Prabhakar.A15-Mar-05 3:20
Prabhakar.A15-Mar-05 3:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.