Click here to Skip to main content
15,896,312 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: cached dll's Pin
cmarmr15-Mar-04 7:08
cmarmr15-Mar-04 7:08 
GeneralRe: cached dll's Pin
Heath Stewart15-Mar-04 7:15
protectorHeath Stewart15-Mar-04 7:15 
GeneralRe: cached dll's Pin
cmarmr15-Mar-04 8:34
cmarmr15-Mar-04 8:34 
GeneralRe: cached dll's Pin
Heath Stewart15-Mar-04 11:34
protectorHeath Stewart15-Mar-04 11:34 
GeneralRe: cached dll's Pin
cmarmr15-Mar-04 15:16
cmarmr15-Mar-04 15:16 
Generalw95 application Pin
Rob Tomson15-Mar-04 4:29
Rob Tomson15-Mar-04 4:29 
GeneralRe: w95 application Pin
Heath Stewart15-Mar-04 5:20
protectorHeath Stewart15-Mar-04 5:20 
GeneralRe: w95 application Pin
Rob Tomson15-Mar-04 5:44
Rob Tomson15-Mar-04 5:44 
GeneralRe: w95 application Pin
Heath Stewart15-Mar-04 5:45
protectorHeath Stewart15-Mar-04 5:45 
Generalmultiple workstations to one database Pin
ASGill15-Mar-04 4:28
ASGill15-Mar-04 4:28 
GeneralRe: multiple workstations to one database Pin
Heath Stewart15-Mar-04 5:18
protectorHeath Stewart15-Mar-04 5:18 
Questionfolder path syntax? Pin
Anonymous15-Mar-04 3:32
Anonymous15-Mar-04 3:32 
AnswerRe: folder path syntax? Pin
John Fisher15-Mar-04 4:15
John Fisher15-Mar-04 4:15 
AnswerRe: folder path syntax? Pin
Dave Kreskowiak15-Mar-04 7:05
mveDave Kreskowiak15-Mar-04 7:05 

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.