Hi! I'm doing a custom function that will change the text on the menuItem on the frmMDI form. Hi have this:
VB Code:
Module _mod Public parent As frmMDI Function loadLanguageString(ByVal lang) ' create a connection string Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Documents and Settings\jeanca.DSD-LAN\Desktop\Signs PRO\Signs PRO\signspro.mdb" Dim conn As OleDbConnection = New OleDbConnection conn.ConnectionString = strConn ' set the string table to load Dim tblString As String If lang = "FRENCH" Then tblString = "tbl_french_string" ElseIf lang = "ENGLISH" Then tblString = "tbl_english_string" End If ' create a data adapter Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select * from " & tblString, conn) ' create a new dataset Dim ds As DataSet = New DataSet ' fill dataset da.Fill(ds, "string") ' write dataset contents to an xml file by calling WriteXml method [COLOR=Sienna]parent.MenuItem1.Text = ds.Tables("string").Rows(0).Item(2)[/COLOR] 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???




Reply With Quote