473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Accessing form from module

dear sir

In my vb.net window application i have the MDI form MainMDI and child form form1 adn module as MainModule
In my MainMDI Parent form i have one toolbar i.e. tbraction. I am trying to show the toolbar when i am displaying form1 (child form) . when i close the child form i want it to be hiddeni.e. invisible

i wrote the code in MainModule as

Friend Module MainModule

Friend frmMDI As MainMDI

End Module

and in the child form closed event i wrote:
Private Sub form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
On Error GoTo errHandler

frmMDI.tbrAction.Visible = False
Exit Sub

errHandler:
If Err.Number <> 0 Then
MsgBox(Err.Number & vbCrLf & Err.Description)
End If
but while accessing the code it give me error

Error 91
Object reference not set to an instance of the object
Please let me know how to solve this error.
thanks
Mustafa


Jul 21 '05 #1
1 1674
Mustafa,

Which object is throwing that error?

if it's Friend frmMDI As MainMDI then you need to set it to something.

Friend frmMDI As New MainMDI?

I'm not too sure since I never liked using modules, but too all their own. You might need to take time in examining it.

Lastly, I see On Error GoTo.. That made my skin crawl.

Try
' code
Catch exp As Exception
System.Diagnostics.Debug.WriteLine(exp.ToString)
MsgBox(exp.ToString)
End Try

^ that's better means of error handling.
Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: David | last post by:
Hi, I am having trouble with a form that I have loaded trying to access a procedure on the main form. The trouble seems to be that a Global Array that is declare in a Module is producing a...
9
by: Bob | last post by:
Hello: I have a form with 26 panels. Each panel has a bunch of other controls in it. The panels visible property are set to False. Each panel has a corosponding button to set it's visible...
1
by: Mustafa | last post by:
dear sir In my vb.net window application i have the MDI form MainMDI and child form form1 adn module as MainModule In my MainMDI Parent form i have one toolbar i.e. tbraction. I am trying to show...
6
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.