Hi! I'm doing a custom function that will change the text on the menuItem on the frmMDI form. Hi have this:
VB Code:
  1. Module _mod
  2.     Public parent As frmMDI
  3.  
  4.  
  5.  
  6.     Function loadLanguageString(ByVal lang)
  7.  
  8.         ' create a connection string
  9.         Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  10.                                 "Data Source=C:\Documents and Settings\jeanca.DSD-LAN\Desktop\Signs PRO\Signs PRO\signspro.mdb"
  11.         Dim conn As OleDbConnection = New OleDbConnection
  12.  
  13.  
  14.         conn.ConnectionString = strConn
  15.  
  16.         ' set the string table to load
  17.         Dim tblString As String
  18.         If lang = "FRENCH" Then
  19.             tblString = "tbl_french_string"
  20.         ElseIf lang = "ENGLISH" Then
  21.             tblString = "tbl_english_string"
  22.         End If
  23.  
  24.         ' create a data adapter
  25.         Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from " & tblString, conn)
  26.  
  27.         ' create a new dataset
  28.         Dim ds As DataSet = New DataSet
  29.  
  30.         ' fill dataset
  31.         da.Fill(ds, "string")
  32.  
  33.  
  34.         ' write dataset contents to an xml file by calling WriteXml method
  35.  
  36.         [COLOR=Sienna]parent.MenuItem1.Text = ds.Tables("string").Rows(0).Item(2)[/COLOR]
  37.     End Function

but I get an error when I refer to parent at the last line: "Object reference not set to an instance of an object."

anyone can help? where should I declare the form so I can refer to them everywhere???