Set Row Pointer in one Form from another

wchestnut

New member
Joined
Nov 1, 2013
Messages
4
Programming Experience
10+
Please bare with me... I'm an older dBase/FoxPro/VB6 developer that's new to VB.Net.

In Visual Studio Express 2012 for Windows, I have a Search form with a DataGridView which includes an "Edit" column button along with the search results. I'd like to be able to re-use a simple Edit form I created before by dragging the Table from Data Sources to the form in Details view.

Is there a way I can take the SQL unique row "ID" value from the search results form and somehow set the row pointer in the detailed Edit form after Form_Edit.Show() -- assuming that's how it would be done? Hopefully that makes sense.
 
Actually, I was able to make it happen, but I'm sure there's a much better way:

Form_Edit.Show()
Do While True
If Form_Edit.Id_Label.Text = Sp_search_resume_textDataGridView.Rows(e.RowIndex).Cells(0).Value.ToString Then
Exit Do
End If
Form_Edit.BindingNavigatorMoveNextItem.PerformClick()
Loop

This method scans the entire dataset. Since it's a small sample (only 10 records), it appears instant. But I'd like to be able to set the row pointer by the rows ID.
 
Back
Top