473,387 Members | 1,530 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,387 software developers and data experts.

weird error upon form loading

hi, i have a few forms in my project. when i load form1 (startup for) all is
fine, then i open another one and use a login screen to call yet another and
all is still fine, but then when i try to open another form from a 3rd form,
it gives this error on form1

"An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome
Nov 21 '05 #1
16 1326
iwdu15 wrote:
hi, i have a few forms in my project. when i load form1 (startup for) all is
fine, then i open another one and use a login screen to call yet another and
all is still fine, but then when i try to open another form from a 3rd form,
it gives this error on form1

"An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.

Additional information: Object reference not set to an instance of an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome

I think this is what is happening....

Dim frm As New OldBrackets <- Create a new form store it in frm
Close() <- Close current form and all it's variables including frm
frm.Show() <- frm has been released, now you get your error.

Maybe try:
Dim frm As New OldBrackets
frm.Show()
Close()

Nov 21 '05 #2
"iwdu15" <iw****@discussions.microsoft.com> schrieb
hi, i have a few forms in my project. when i load form1 (startup
for) all is fine, then i open another one and use a login screen to
call yet another and all is still fine, but then when i try to open
another form from a 3rd form, it gives this error on form1

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of
an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome

What is the line throwing the error? Please post the callstack when the
error occurs (menu debug -> windows -> callstack).
Armin

Nov 21 '05 #3
"Chris" <no@spam.com> schrieb
iwdu15 wrote:
hi, i have a few forms in my project. when i load form1 (startup
for) all is fine, then i open another one and use a login screen
to call yet another and all is still fine, but then when i try to
open another form from a 3rd form, it gives this error on form1

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of
an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome

I think this is what is happening....

Dim frm As New OldBrackets <- Create a new form store it in frm
Close() <- Close current form and all it's variables including frm
frm.Show() <- frm has been released, now you get your error.

This is not right. Close closes the form, i.e. the corresponding window,
nothing else. frm is a local variable and still holds a reference to the new
Form, thus frm is not Nothing after closing the form and frm.show can not
throw the exception - maybe within one of the sub procedures but not because
frm is nothing.
Armin

Maybe try:
Dim frm As New OldBrackets
frm.Show()
Close()


Nov 21 '05 #4
this is gunna throw all you guys for a loop....it shows an error, highlighted
in green on this line:

Public Class Form1

this has got me stumped, i have a few imports so maybe its with one of them,
although i dont get any errors on them, but here they are anyway

Imports System.Runtime.InteropServices
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports MsdnMag

so anyone that can help id be grateful
Nov 21 '05 #5
i thought it might be an error with the gererated code so i made a new form
and copyied all the code (besides the windows designer code) to the new form
and remade the second form to be exactly like the first but it gsave the
error on the new form also
Nov 21 '05 #6
"iwdu15" <iw****@discussions.microsoft.com> schrieb
i thought it might be an error with the gererated code so i made a
new form and copyied all the code (besides the windows designer
code) to the new form and remade the second form to be exactly like
the first but it gsave the error on the new form also

Without posting the callstack as suggested, I am not able to help you.
Armin
Nov 21 '05 #7
sorry, my bad, heres what i copied from the call stack
Brackets.exe!Brackets.Main.Main() Line 6 + 0x1d bytes Basic


Nov 21 '05 #8
"iwdu15" <iw****@discussions.microsoft.com> schrieb
sorry, my bad, heres what i copied from the call stack
Brackets.exe!Brackets.Main.Main() Line 6 + 0x1d bytes Basic


This is the complete callstack? Well, possible. I wonder why the error
occurs there because you write it doesn't happen before you open another
form.

What if you add this sub to your startup form:

shared sub main
dim f as new form1 'assuming form1 is the startup form
application.run(f)
end sub

Where does the error occur now, and what does the callstack say?

More questions: Are you working with threads? Do you have shared members in
your startup Form?
Armin

Nov 21 '05 #9
when i did the shared sub main thing, it still happened and the call stack
was empty, as for threads....id ont think im using them...im guessing if i
dont kno them im prob not, so the same for shared members...and for my
startup form, all it does is load settings from an ini file, which has worked
since i started this project, save settings, and open new forms based on
button clicks. but when i open a certain form, which doesnt have a formload
event, it crashes, if u need more source code just tell me
Nov 21 '05 #10
ok well another weird thing, when i made the form (the one that when it
loads, gives an error on another form) the startup form, all was well and good
Nov 21 '05 #11
"iwdu15" <iw****@discussions.microsoft.com> schrieb
when i did the shared sub main thing, it still happened and the call
stack was empty, as for threads....

Did you pause (ctrl+break) the program? There must be something in the
callstack.
id ont think im using them...im
guessing if i dont kno them im prob not, so the same for shared
members...and for my startup form, all it does is load settings from
an ini file, which has worked since i started this project, save
settings, and open new forms based on button clicks. but when i open
a certain form, which doesnt have a formload event, it crashes, if u
need more source code just tell me

If it's possible to send me the whole project (zipped, please), send it to
az*******@freenet.de but insert an underscore between "no" and "spam" in the
address before.
Armin

Nov 21 '05 #12
sent, and thanks a ton
Nov 21 '05 #13
"iwdu15" <iw****@discussions.microsoft.com> schrieb
sent, and thanks a ton


Hew.. pretty big project... I'll have a look. :-)
Armin
Nov 21 '05 #14
"iwdu15" <iw****@discussions.microsoft.com> schrieb
hi, i have a few forms in my project. when i load form1 (startup
for) all is fine, then i open another one and use a login screen to
call yet another and all is still fine, but then when i try to open
another form from a 3rd form, it gives this error on form1

"An unhandled exception of type 'System.NullReferenceException'
occurred in Unknown Module.

Additional information: Object reference not set to an instance of
an object."

yet the form has opened, but then the program just crashes...

heres how i open the form:

Dim frm As New OldBrackets
Close()
frm.Show()

im puzzled so any help is awsome

After he sent the project to me, it turned out to be the following problem:

http://groups.google.com/groups?as_q...ublic.dotnet.*

Easiest way to reproduce the problem is to add a combobox (add some items)
in a new empty project and call Me.Close in it's selectedindexchanged event.

I didn't have a solution. Anybody?
Armin

Nov 21 '05 #15
"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
i thought it might be an error with the gererated code so i made a new form and copyied all the code (besides the windows designer code) to the new form and remade the second form to be exactly like the first but it gsave the
error on the new form also


To forget to tell us the actual error message you are getting /once/ might
be construed as an oversight; to do so twice seems like you're
just trying to be annoying.

What is [the complete wording of] the Error that you are getting???

Regards,
Phill W.
Nov 21 '05 #16
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> schrieb
"iwdu15" <iw****@discussions.microsoft.com> wrote in message
news:DD**********************************@microsof t.com...
i thought it might be an error with the gererated code so i made a
new

form
and copyied all the code (besides the windows designer code) to
the new

form
and remade the second form to be exactly like the first but it
gsave the error on the new form also


To forget to tell us the actual error message you are getting /once/
might be construed as an oversight; to do so twice seems like you're
just trying to be annoying.

What is [the complete wording of] the Error that you are getting???

Maybe you didn't read the whole thread: He mailed the project to me, and
after I found the cause of the error I posted it here also in the case
somebody might have a solution:

http://groups-beta.google.com/group/...3a6f2179bfd945
Armin

Nov 21 '05 #17

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

Similar topics

3
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed...
8
by: Alan Little | last post by:
I started with the following code in an included file: $CompanyBlock = "$Company (Booth#: $Booth)\n". "$Address\n". "$City, $State $PostalCode\n". "$Website\n". "$Contact1, $Title1\n"....
0
by: oj | last post by:
I have a dataset with a parent table and 3 child tables. The dataset is filled and manipulated on one particular web page. During the user interaction one of the child tables can have records...
0
by: HKSHK | last post by:
This list compares the error codes used in VB.NET 2003 with those used in VB6. Error Codes: ============ 3: This Error number is obsolete and no longer used. (Formerly: Return without GoSub)...
8
by: Radx | last post by:
Here in my web application, I have a data entry page with serval controls. Some of the controls have autopostback is set true. But the problem is when two or more people are entering data at the...
1
by: Carl J. Van Arsdall | last post by:
Hey everyone, cPickle is raising an ImportError that I just don't quite understand. Before I paste the code, let me explain the application. Basically the part of the application that failed is a...
0
by: Henrootje | last post by:
I have a problem which I do not understand........................ I have a split database. Tables in the backend on a networkdrive, all other in frontend placed in %temp% I have this form ...
6
by: Cruithne3753 | last post by:
I'm trying to create a Windows app with a clickable index of images within a local folder. Within a loop I've got:- PictureBox pb = new PictureBox(); pb.Image = Image.FromFile(file); .......
3
Alireza355
by: Alireza355 | last post by:
I have a switchboard, which maximises upon loading. In the form DETAIL section, I have embedded a picture, so when the form opens and maximises, the picture is the background. The picture is 1024...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.