Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with DataGridView !!!

Status
Not open for further replies.

Webwzrd

Programmer
Apr 23, 2002
40
0
0
US

Here is my problem: I have populated my dataset from an XML document. I have verified that the data is in the dataset. I have set the datasource for the databindingSOurce to be " BS1.datasource = ds.Tables(0)"

I then set the Datasource for the DataGridView to BS1

And All I still get is a grey box! Can someone please tell me what I'm doing wrong????

Here is my code:

Dim ds As New DataSet
ds.ReadXml(getFilePath() & "\ScheduleData.xml", XmlReadMode.InferSchema)

BS1.DataSource = ds.Tables(0)
dg1.DataSource = BS1



 
off top of my head as I'm dealing with my own problem, don't you need a dg1.databind() ?
 

The windows DataGridView dosnt have a DataBinde() Method.
 

No, this is a windows app. Thats why I'm having trouble.
 
No, this is a windows app. Thats why I'm having trouble.

Huh?

Why are you using the DataGridVeiw? You don't need it! it is used for Excel... Not a DataGrid.

Just use:
Code:
dg1.DataSource = ds.Tables(0)

and get rid of the DataGridVeiw object. If you want to sort and filter a dataset post query, then you can use something like this:
Code:
Dim dv as New DataView(ds.Tables(0))
dv.RowFilter = "SomeColumn='criteria'"
dv.Sort = "SomeColumn DESC"
dg1.DataSource = ds.Tables(0)

Make sense?

Senior Software Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top