469,962 Members | 2,087 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,962 developers. It's quick & easy.

Error in showdialog of form.

Hi all
I am new to vb.net application.
I am using showdialog property of form to display form.
First time it is working properly.
But next time it is giving me error that ' object reference not set to
an instance of an object'.

When i went through stacktrace, i found that it is giving error in
showwindow.
I am not getting why it is happening.
Can some one tell me reason behing this.
Please help me.
Thanks in advance.

Nov 21 '05 #1
4 4989
Trial,

Mostly are this kind of question easy to answer if there is some code.
How do you want us to do it now, you could have done almost everything.

However in this case have you probably set your form globally.

The most simple way is just there where you want to use it to do.

\\\
dim frm1 as new Form2
frm1.showdialog(me)
frm1.dispose
///

This saves you than as well some memory and is as efficient as any other
way.

I hope this helps,

Cor
Nov 21 '05 #2
<tr**************@yahoo.com> schrieb:
I am using showdialog property of form to display form.
First time it is working properly.
But next time it is giving me error that ' object reference not set to
an instance of an object'.

When i went through stacktrace, i found that it is giving error in
showwindow.
I am not getting why it is happening.


Please post the complete error message + callstack, if available.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #3
Hi.
I am posting stacktrace as below:-
Please check this and tell me solution if u know.

Stack trace.
Object reference not set to an instance of an object. at
System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef hWnd, Int32
nCmdShow)

at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)

at System.Windows.Forms.Form.SetVisibleCore(Boolean value)

at System.Windows.Forms.Control.set_Visible(Boolean value)

at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

at System.Windows.Forms.Form.ShowDialog()

at System.Windows.Forms.ThreadContext.OnThreadExcepti on(Exception t)

at System.Windows.Forms.Control.WndProcException(Exce ption e)

at
System.Windows.Forms.ControlNativeWindow.OnThreadE xception(Exception e)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

at System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef hWnd,
Int32 nCmdShow)

at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)

at System.Windows.Forms.Form.SetVisibleCore(Boolean value)

at System.Windows.Forms.Control.set_Visible(Boolean value)

at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

at form1.cDownLoader.DownLoadFile(String sRemotePath, Int64
lFileSize, String
sDate)System.NullReferenceExceptionSystem.NullRefe renceException:
Object reference not set to an instance of an object.

at System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef hWnd,
Int32 nCmdShow)

at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)

at System.Windows.Forms.Form.SetVisibleCore(Boolean value)

at System.Windows.Forms.Control.set_Visible(Boolean value)

at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

at System.Windows.Forms.Form.ShowDialog()

at System.Windows.Forms.ThreadContext.OnThreadExcepti on(Exception t)

at System.Windows.Forms.Control.WndProcException(Exce ption e)

at
System.Windows.Forms.ControlNativeWindow.OnThreadE xception(Exception e)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

at System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef hWnd,
Int32 nCmdShow)

at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)

at System.Windows.Forms.Form.SetVisibleCore(Boolean value)

at System.Windows.Forms.Control.set_Visible(Boolean value)

at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)

at form1.cDownLoader.DownLoadFile(String sRemotePath, Int64
lFileSize, String sDate)

Nov 21 '05 #4
<tr**************@yahoo.com> schrieb:
I am posting stacktrace as below:-
[Stacktrace]


I am curious what 'cDownLoader.DownLoadFile' does. Are you using
multithreading?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Richard L Rosenheim | last post: by
20 posts views Thread by ed | last post: by
1 post views Thread by Joel Whitehouse | last post: by
3 posts views Thread by Jorge | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.