Click here to Skip to main content
15,905,686 members
Home / Discussions / C#
   

C#

 
GeneralRe: iterate through enum Pin
Christian Graus15-Mar-04 14:34
protectorChristian Graus15-Mar-04 14:34 
GeneralForms & variables & suchlike Pin
surgeproof15-Mar-04 10:54
surgeproof15-Mar-04 10:54 
GeneralRe: Forms & variables & suchlike Pin
Judah Gabriel Himango15-Mar-04 11:07
sponsorJudah Gabriel Himango15-Mar-04 11:07 
GeneralRe: Forms & variables & suchlike Pin
surgeproof16-Mar-04 8:16
surgeproof16-Mar-04 8:16 
GeneralRe: Forms & variables & suchlike Pin
surgeproof17-Mar-04 6:38
surgeproof17-Mar-04 6:38 
GeneralProcessDialogKey and AppDomain Pin
zilch15-Mar-04 9:37
zilch15-Mar-04 9:37 
GeneralRe: ProcessDialogKey and AppDomain Pin
Heath Stewart15-Mar-04 9:55
protectorHeath Stewart15-Mar-04 9:55 
GeneralRe: ProcessDialogKey and AppDomain Pin
Nemanja Trifunovic15-Mar-04 10:23
Nemanja Trifunovic15-Mar-04 10:23 
GeneralRe: ProcessDialogKey and AppDomain Pin
Heath Stewart15-Mar-04 10:50
protectorHeath Stewart15-Mar-04 10:50 
GeneralRe: ProcessDialogKey and AppDomain Pin
zilch15-Mar-04 10:34
zilch15-Mar-04 10:34 
GeneralRe: ProcessDialogKey and AppDomain Pin
Heath Stewart15-Mar-04 10:48
protectorHeath Stewart15-Mar-04 10:48 
GeneralRe: ProcessDialogKey and AppDomain Pin
zilch15-Mar-04 11:12
zilch15-Mar-04 11:12 
GeneralRe: ProcessDialogKey and AppDomain Pin
Heath Stewart15-Mar-04 11:27
protectorHeath Stewart15-Mar-04 11:27 
GeneralRe: ProcessDialogKey and AppDomain Pin
zilch15-Mar-04 12:43
zilch15-Mar-04 12:43 
GeneralRe: ProcessDialogKey and AppDomain Pin
zilch15-Mar-04 13:09
zilch15-Mar-04 13:09 
QuestionRe: ProcessDialogKey and AppDomain Pin
gratajik31-Jan-11 13:38
gratajik31-Jan-11 13:38 
GeneralTask Bar Pin
SherKar15-Mar-04 7:40
SherKar15-Mar-04 7:40 
GeneralRe: Task Bar Pin
Judah Gabriel Himango15-Mar-04 9:12
sponsorJudah Gabriel Himango15-Mar-04 9:12 
GeneralRe: Task Bar Pin
Stefan Troschuetz15-Mar-04 9:51
Stefan Troschuetz15-Mar-04 9:51 
GeneralRe: Task Bar Pin
Heath Stewart15-Mar-04 10:01
protectorHeath Stewart15-Mar-04 10:01 
Generalregd dataset Pin
karteek15-Mar-04 6:46
karteek15-Mar-04 6:46 
GeneralRe: regd dataset Pin
Heath Stewart15-Mar-04 6:56
protectorHeath Stewart15-Mar-04 6:56 
You can't get the schema from the DataGrid like you're probably hoping. You could construct an XmlDocument (or use an XmlTextWriter) to build a schema while enumerating through the tables and column definitions, but the easiest way is to create a typed DataSet by adding a new DataSet schema to your project and designing the desired schema in there. VS.NET can generate a typed DataSet class (with actual table and column names, as well as the proper column types and fewer look-ups). You can use this to bind more easily to a DataGrid. At the very least - if you don't want to use the actual typed DataSet - you'll have a schema that you can use for DataSet.ReadXmlSchema for a generic DataSet instance.

To bind to a DataGrid, though, you really don't need to know the schema in advance. You can always set the DataGrid.DataSource property to the DataSet instance (filled) and optionally set the DataMember to myDataSet.Tables[0].TableName. By default, columns are generated automatically. If you know the schema up-front - you don't even have to import any schema - you can pre-set the DataGrid.DataMember property to the table name and add a DataGridTableStyle to DataGrid.TableStyles that uses the same table name. Optionally, you can add various DataGridColumnStylesd to the associated DataGridTableStyle.GridColumnStyles collection property and set DataGrid.AutoGenerateColumns to false. See the documentation for any one of the mentioned classes and / or properties for more information and examples.

 

Microsoft MVP, Visual C#
My Articles
Generalcached dll's Pin
cmarmr15-Mar-04 6:04
cmarmr15-Mar-04 6:04 
GeneralRe: cached dll's Pin
Heath Stewart15-Mar-04 6:20
protectorHeath Stewart15-Mar-04 6:20 
GeneralRe: cached dll's Pin
Heath Stewart15-Mar-04 6:22
protectorHeath Stewart15-Mar-04 6:22 

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.