andy.mahood@eu.effem.com
Member
- Joined
- Sep 15, 2005
- Messages
- 6
- Programming Experience
- 1-3
I have a datagrid on one form, for example is may look like below
ID NAME COMPANY
1 Steve Microsoft
2 Bill Apple
3 John Google
i have another form that pops up to deliver more detail on each row,
what i am looking for is away to navigate through the records of the data grid from the popup form.
This is very similar to the 'Get Info' form of iTunes if you have used it that may help if not then, the form has next and previous buttons that when clicked go to the next row of the datagrid and present relevant detail in the popup from.
I have tried...
Creating a public sub on Main Form and calling it from the popup form:
On Pop Up form:
with this method i get the error:
System.InvalidOperationException: Data cannot be read from a DataGrid which is not bound to a DataTable.
at System.Windows.Forms.DataGrid.EnsureBound()
at System.Windows.Forms.DataGrid.get_Item(Int32 rowIndex, Int32 columnIndex)
at App.frmScheduleMonitoring.NextRecord() in C:\frmMainForm.vb:line 3798
I hope my question makes sense to you all, and thank you for your assistance.
ID NAME COMPANY
1 Steve Microsoft
2 Bill Apple
3 John Google
i have another form that pops up to deliver more detail on each row,
what i am looking for is away to navigate through the records of the data grid from the popup form.
This is very similar to the 'Get Info' form of iTunes if you have used it that may help if not then, the form has next and previous buttons that when clicked go to the next row of the datagrid and present relevant detail in the popup from.
I have tried...
Creating a public sub on Main Form and calling it from the popup form:
visual basic code:Public Sub NextRecord()
Dim frmPopUp As frmPopUp = New frmPopUp
Dim intID As Integer
intID = DataGrid1.Item(DataGrid1.CurrentRowIndex+1, 0)
frmPopUp.SubToPresentDetail(intID)
end sub
Dim frmPopUp As frmPopUp = New frmPopUp
Dim intID As Integer
intID = DataGrid1.Item(DataGrid1.CurrentRowIndex+1, 0)
frmPopUp.SubToPresentDetail(intID)
end sub
On Pop Up form:
visual basic code:Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim frmMainForm As frmMainForm = New frmMainForm
frmMainForm.NextRecord()
End Sub
Dim frmMainForm As frmMainForm = New frmMainForm
frmMainForm.NextRecord()
End Sub
with this method i get the error:
System.InvalidOperationException: Data cannot be read from a DataGrid which is not bound to a DataTable.
at System.Windows.Forms.DataGrid.EnsureBound()
at System.Windows.Forms.DataGrid.get_Item(Int32 rowIndex, Int32 columnIndex)
at App.frmScheduleMonitoring.NextRecord() in C:\frmMainForm.vb:line 3798
I hope my question makes sense to you all, and thank you for your assistance.