Selecting in a DataGrid

  • Thread starter Thread starter Jackmac
  • Start date Start date
J

Jackmac

Hi all,

Hopefully someone can offer some advice. I've got a form with two data
grids on it. One has names of boxes in it, the other grid has contents of
the boxes. I want to click on a box in grid 'A' and the contents show in
box 'B'. At present it shows the contents of any box I click on. When I go
to another box, it shows the contents for that box. If I go back to any
choice I've made already, it crashes out. Any ideas? The code I'm using is
shown below:

Dim ws_BoxID As String

ws_BoxID = BoxGrid.Rows(BoxGrid.CurrentCell.RowIndex).Cells(0).Value

Dim ws_SQL As String = "SELECT * FROM BoxContent WHERE BoxID = '" & ws_BoxID
& "'"

Debug.Print(ws_SQL)

Dim myDataTable As DataTable

myDataTable = GetDataTableADONET(ws_SQL)

BoxInfoGrid.DataSource = myDataTable

DataGridView1.DataSource = myDataTable
 
Hi all,

Hopefully someone can offer some advice. I've got a form with two data
grids on it. One has names of boxes in it, the other grid has contents of
the boxes. I want to click on a box in grid 'A' and the contents show in
box 'B'. At present it shows the contents of any box I click on. When I go
to another box, it shows the contents for that box. If I go back to any
choice I've made already, it crashes out. Any ideas? The code I'm using is
shown below:

Dim ws_BoxID As String

ws_BoxID = BoxGrid.Rows(BoxGrid.CurrentCell.RowIndex).Cells(0).Value

Dim ws_SQL As String = "SELECT * FROM BoxContent WHERE BoxID = '" & ws_BoxID
& "'"

Debug.Print(ws_SQL)

Dim myDataTable As DataTable

myDataTable = GetDataTableADONET(ws_SQL)

BoxInfoGrid.DataSource = myDataTable

DataGridView1.DataSource = myDataTable

"crashes out" is hardly descriptive.

What happens?
If there is a runtime error, on which line?
Where is the code you posted (BoxGrid SelectionChanged event?)
What is DataGridView1?
 
Jack Jackson said:
"crashes out" is hardly descriptive.

What happens?
If there is a runtime error, on which line?
Where is the code you posted (BoxGrid SelectionChanged event?)
What is DataGridView1?

Hi Jack,

There is no runtime error, it says that I should relax or turn off
constraints in my DataSet. I haven't set any that I'm aware of.
DataGridView1 is one of the DataGrids
 
Back
Top