SteveInBeloit
Well-known member
- Joined
- May 22, 2006
- Messages
- 132
- Programming Experience
- 10+
On my Main form, I want to select a row, then click an edit button and have values of columns on that form populate global variables.
In my Global Variable Module, I have: (don't know if I need this)
Public dsGrid1 As DataSet
In the on-load of the main form I have:
Dim daGrid1 As New SqlDataAdapter(Me.SqlCommand1)
Dim dsGrid1 As New DataSet
dsGrid1.Clear()
daGrid1.Fill(dsGrid1, "top")
DataGrid1.DataSource = dsGrid1.Tables(0).DefaultView
DataGrid1.CaptionVisible = False
DataGrid1.PreferredColumnWidth = 100
In the on-click of the edit button,, I have:
me.txtTestBox.DataBindings.Add("Text", dsGrid1.Tables(0).DefaultView(DataGrid1.CurrentRowIndex), "Task")
At this point in the on-click of the edit button, dsGrid1 (dataset) is = nothing. So it isn't getting to the txtTestBox. I think if I can get it there, I could put the values in global variables.
Shouldn't this be easy enough?
In my Global Variable Module, I have: (don't know if I need this)
Public dsGrid1 As DataSet
In the on-load of the main form I have:
Dim daGrid1 As New SqlDataAdapter(Me.SqlCommand1)
Dim dsGrid1 As New DataSet
dsGrid1.Clear()
daGrid1.Fill(dsGrid1, "top")
DataGrid1.DataSource = dsGrid1.Tables(0).DefaultView
DataGrid1.CaptionVisible = False
DataGrid1.PreferredColumnWidth = 100
In the on-click of the edit button,, I have:
me.txtTestBox.DataBindings.Add("Text", dsGrid1.Tables(0).DefaultView(DataGrid1.CurrentRowIndex), "Task")
At this point in the on-click of the edit button, dsGrid1 (dataset) is = nothing. So it isn't getting to the txtTestBox. I think if I can get it there, I could put the values in global variables.
Shouldn't this be easy enough?