Hi, I’m trying to bind controls on multiple forms. I have a datagrid on the main form which I’ve set to read only and a separate dialog form to perform the editing of a selected record. the problem however is that I don't know how to point to the record selected from the datagrid and display that record on the form. I can get it to display the first record in that table but don't know how to move it on to the selected other records in the datagrid. I have found an example in the Microsoft ADO.NET book which I’ve worked thought but it misses out some of the code. The section they show is below which uses an editdetail method to binds the textboxes to the datagrid, they also mention that this is called from a button event which creates an instance of the form and then calls the method (below) on the form. I was just wondering if anyone had any ideas:
Thanks!
thanks
Thanks!
VB.NET:
dim drvdetail as datarowview
dim vuedetail as dataview
Public Sub editdetails(ByVal cm As CurrencyManager)
Dim dlgnew As New addnewenrollment
drvdetail = CType(Me.cmorder.Current, DataRowView)
vuedetail = drvdetail.DataView
Me.BindingContext(vuedetail).Position = Me.cmorder.Position
dlgnew.TextBox1.DataBindings.Add("text", vuedetail, "Enrolment_ID")
dlgnew.TextBox2.DataBindings.Add("text", vuedetail, "Client_No*")
dlgnew.TextBox3.DataBindings.Add("text", vuedetail, "Course_ID")
dlgnew.TextBox4.DataBindings.Add("text", vuedetail, "Date_Enrolled")
dlgnew.TextBox5.DataBindings.Add("text", vuedetail, "Date_Canceled")
dlgnew.TextBox6.DataBindings.Add("text", vuedetail, "Achived")
dlgnew.TextBox7.DataBindings.Add("text", vuedetail, "Client_Status")
if me.showdialog = dialogresult.ok then
cm.endcurrentEdit()
else
cm.cancelcurrentedit()
end if
End Sub
Last edited by a moderator: