datagridview has no data

alexlashford

Member
Joined
Jul 20, 2007
Messages
7
Programming Experience
Beginner
hi im a relative newbie to vb.net, im having trouble populating a datagrid, I have a connection to an accessdb which all works and i have created a dataset which is used to populate a datatable, this data table is then copied to another datatable which is then queried using the .select(FILTERSTRING). The problem i am having is that when i perform the query and reload the rows into the table then add it to the datagrid nothing appears in the boxs, but there are the correct number of rows.
here is my code:
Shared BlisterOrdersTable As DataTable

in the load_form method at the mo. // will put in seperate method

' load database
dbConnect()

' Assign data table to data grid
'DataGridView1.DataSource = ActiveOrdersTable

BlisterOrdersTable = ActiveOrdersTable
'DataGridView1.DataSource = BlisterOrdersTable

Dim strExp As String
strExp = "[ANALYSIS_CODE#1] = '9009'"

Dim foundRows As DataRow()
Try
foundRows = BlisterOrdersTable.Select(strExp)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

BlisterOrdersTable.Clear()

Dim d As Integer
Try
For d = 0 To foundRows.GetUpperBound(0)
BlisterOrdersTable.Rows.Add(foundRows(d))
Next

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

DataGridView1.DataSource = BlisterOrdersTable

' Both of the messages below show the same correct number
'MessageBox.Show(BlisterOrdersTable.Rows.Count)
'MessageBox.Show(foundRows.Length)


what am i doing wrong, when i run the form dataGridView1 is empty, but there the correct number of rows in the table, just no data, hope someone can help Thanx in advance

alex
 
Back
Top