Frank wrote:
Hi,
I have an vb6 app that I want to port to .net. I tried the wizard but it
doesn't convert it all. In my app I have a form with a datagrid on it. If a
user doubleclicks on a row a form is shown (modal) with details (and some
more info) about the selected row. Under vb6 it's quite easy to select
another row, through code, in de datagrid without closing the detailform. How
can this be done in .net?
Thanks,
Frank
There are many ways...
- Pass a reference to the datagrid into the child form
- Pass a reference of the parent form and open a property to change the
row.
- Invoke a delegate on the parent form
example:
public class ChildForm
private refToDataGrid as DataGrid
public shadows sub ShowDialog(ParentDataGrid as DataGrid)
refToDataGrid = ParentDataGrid
mybase.showdialog
end sub
Sub MoveDataGridRow()
refToDataGrid.CurrentRowIndex = newRow
end sub
End Class
public class parentForm
public sub OpenChildForm
dim C as new ChildForm
C.ShowDialog(C)
end sub
end class