Question Data loading FROM the grid

JayWalker

Member
Joined
Jun 20, 2011
Messages
15
Programming Experience
Beginner
hello everyone,

Okay so I have a grid loaded with data. What I wanna do is when you double click on the row header, the data in that row should load into a form with textboxes. I've chosen the RowHeaderMouseDoubleClick as the evnt for this but dunno how to start. a little help with some example code would be really appreciated.

Thanks very much.
 

JayWalker

Member
Joined
Jun 20, 2011
Messages
15
Programming Experience
Beginner
still stuck... :/

I got the general idea from ur article and thanks for that. But I'm still a little bit stuck. :confused:

Okay I'll give u the picture of the program I'm working on.
There's a Main menu (which is a MDI container). And there is a form called frmCourseMaster as a children form.

formcoursemaster.png lec finder.png

when I click the button that is pointed, it shows up a another form which you can search for a certain record and when you double click on it, the Name loads in to the textbox that is located by the side.

I wrote the code as you have explained in ur article. But then when I try to run the program it throws the following error.

main menu code.png

And I'm confused at some points.
let's say,
To load another form(a) within a form(b), which is already a childern form of the main menu(c), do I have to set the IsmdiContainer to true of the (b) form..?? (I think its impossible coz it throws an error saying a single form can't be both parent and children, right?)

Or is it some other reason I'm overlooking..??

Please clear this up for me.. :)

Below is the code which I wrote,

in the 'Find' form :-

VB.NET:
Private Sub gridLecFind_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles gridLecFind.CellDoubleClick

        Dim dtrow As DataRow = DirectCast(Me.BindingSource1.Current, DataRowView).Row

        Using lecFinder As New frmCourseMaster(dtrow)
            lecFinder.ShowDialog()
        End Using

    End Sub


in the 'course master' form :-

VB.NET:
    Public Sub New(ByVal dtr As DataRow)

        InitializeComponent()

        Me.dtr = dtr     'I have declared dtr as DataRow above

        Me.txtLecturer_1.Text = CStr(dtr("Name"))

    End Sub
 
Top Bottom