Datagrid in VB.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madax
    New Member
    • Feb 2010
    • 1

    Datagrid in VB.net

    can someone help me.
    I would like to ask if anyone knows how to use datagrid, that when i clicked or double clicked a data shown in datagrid it will appear in a textbook.

    i'm using this codes

    Dim Col As Integer = 0
    messagebox.show (DataGrid1.Item (DataGrid1.Curr entRowIndex, Col))

    but i don't know how to display the selected item in other form even i had declared a public variable in my module to use.


    thanks much.
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    There are few methods available to pass data between forms. The list goes on as below;
    1. Using constructor
    2. Using objects
    3. Using properties
    4. Using delegates


    Lets just look at the using constructor approach,

    Parent form
    Code:
    Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
    
        Dim myChild As frmChild = New frmChild("the_data_that_you_want_to_pass_over")
        myChild.Show()
    End Sub
    Child form

    * Add a Label control on child form

    Code:
    Public Sub New(ByVal strReceivedData As String)
        InitializeComponent()
        label1.Text = strReceivedData
    End Sub

    Comment

    Working...