joel navarro

joel navarro

  • NA
  • 5
  • 1.6k

cannot pass global variable to control textbox

Sep 5 2011 8:23 PM
i am kind of new to visual basic programming. it's nice to see this forum and maybe you guys can help me. I am using visual basic 2005. here is my problem: 
i have to pass a global variable to a control textbox. but after running the code the textbox is empty:

here is how it should happen:

 Private Sub cmdEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEdit.Click

        frmsearchdialogbox.Show()

    End Sub
 
'search dialog box appears
'type code then click search

 Private Sub cmdsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsearch.Click

        With study
            Try
                If study.selectstudy(Me.txtsearchdiag.Text) = True Then
                    temp.load_data()
                    Me.Close()
                End If

            Catch ex As Exception
                MsgBox(MSG_ERR)
            End Try
        End With

    End Sub

'here is what temp.load_data looks like

Public Function load_data() As Boolean
        ACTION_INDICATOR = 2
        Try
            txtcode.Enabled = True
            txtdescription.Enabled = True

            txtid.Text = gvtemp.gvID
            txtcode.Text = gvtemp.gvCode
            txtdescription.Text = gvtemp.gvDescription

            load_data = True
            Exit Function

            load_data = False
        Catch err As Exception
            MsgBox(MSG_ERR)

        End Try
     

    End Function

but after running the code... txtid, txtcode, and txtdescription is empty. what can be wrong?

i really need help! thanks guys!

Answers (1)