Results 1 to 2 of 2

Thread: [RESOLVED] Calling a value from a Grid to a variable in another form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Resolved [RESOLVED] Calling a value from a Grid to a variable in another form

    I have datagrid in which the 0th column has ID. What i want is while clicking on the datagrid the id of the particular row has to be load in the variable in the second form. For this i have created a public variable in the second form
    Code:
    Public editID As Long
    and in the first form i wrote
    Code:
     Private Sub grdDrugs_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdDrugs.DoubleClick
            frmDrug.Show()
            frmDrug.editID = CInt(grdDrugs.Item(0,grdDrugs.CurrentCell.RowIndex).Value())
    
        End Sub
    but here its not returning any value to EditID while loading the second form

    is there any way to do this

    Thanks
    Sajna

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    India, Kerala, Calicut
    Posts
    242

    Angry Re: Calling a value from a Grid to a variable in another form

    yes it is solved
    i wrote
    Code:
    Private editID As Long
    
        Public Property [PassedValue]() As Long
            Get
                Return editID
            End Get
            Set(ByVal Value As Long)
                editID = Value
            End Set
        End Property
    in form 2

    and

    wrote
    Code:
      Dim Obj As New frmDrug
            Obj.PassedValue = CInt(grdDrugs.Item(0, grdDrugs.CurrentCell.RowIndex).Value())
            Obj.Show()
    in form1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width