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

Form won't show

I'm trying to load a form from the Sub Main procedure in a module (I set Sub
Main as the startup object). I have this line in the declarations section:

Public MnFrm As New MainForm

In the Sub Main procedure, I have this line:

MnFrm.Show()

But when I run the program, the form displays itself for a short second or
two, and then disappears, and the application stops. I used the ShowDialog
method, and it worked, but I don't want to use that if I don't have to
(because of other problems it causes--I want to create a second modeless
form that floats over the main one). Is there some other way around this
problem?
Nov 20 '05 #1
5 1539
Cor
Hi jy

Have you maybe after frm.show still the standard next/last instruction from
the standard showdialog procedure?

frm.dispose

Cor
I'm trying to load a form from the Sub Main procedure in a module (I set Sub Main as the startup object). I have this line in the declarations section:

Public MnFrm As New MainForm

In the Sub Main procedure, I have this line:

MnFrm.Show()

But when I run the program, the form displays itself for a short second or
two, and then disappears, and the application stops. I used the ShowDialog
method, and it worked, but I don't want to use that if I don't have to
(because of other problems it causes--I want to create a second modeless
form that floats over the main one). Is there some other way around this
problem?

Nov 20 '05 #2
"jy836" <mo***@nospam.com> schrieb
I'm trying to load a form from the Sub Main procedure in a module (I
set Sub Main as the startup object). I have this line in the
declarations section:

Public MnFrm As New MainForm

In the Sub Main procedure, I have this line:

MnFrm.Show()

But when I run the program, the form displays itself for a short
second or two, and then disappears, and the application stops. I used
the ShowDialog method, and it worked, but I don't want to use that if
I don't have to (because of other problems it causes--I want to
create a second modeless form that floats over the main one). Is
there some other way around this problem?


MnFrm.Show()
Application.run(MnFrm)

- or only -

Application.run(MnFrm)
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Shared Sub Main()

System.Windows.Forms.Application.Run(New MnFrm())

End Sub
--
----------------------------
Mauro Gamberini
Nov 20 '05 #4
"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
MnFrm.Show()
Application.run(MnFrm)

- or only -

Application.run(MnFrm)


Thanks for your help. Works like a charm... :-D
Nov 20 '05 #5
* "jy836" <mo***@nospam.com> scripsit:
I'm trying to load a form from the Sub Main procedure in a module (I set Sub
Main as the startup object). I have this line in the declarations section:

Public MnFrm As New MainForm

In the Sub Main procedure, I have this line:

MnFrm.Show()

But when I run the program, the form displays itself for a short second or
two, and then disappears, and the application stops. I used the ShowDialog


Your application doesn't have a message loop when using 'Show', as a
consequence, it terminates. You can use 'Application.Run' to create a
message loop and show the Main Form:

\\\
Application.Run(New MainForm())
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

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

Similar topics

13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
4
by: Tonya | last post by:
Hi, Does anyone have any example of how i can manage forms in my application?? I want to be able to reference my form instances that are currently open from other forms. why cant i open...
4
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
7
by: Boni | last post by:
Dear all, if I do myform.close() is it disposed or not? is it correct do following? myForm.close() Info=SomeControlOntheForm.text This seems to work. But am not sure that it is waterproof....
5
by: ortaias | last post by:
I have a form which calls up a second form for purposes of data entry. When closing the data entry form and returning to the main form, things don't work as expected. When I return to the main...
5
by: Charlie Brown | last post by:
I am using the following to load my mdi form into the parent. If Me.frmIncoming Is Nothing Then Me.frmIncoming = New IncomingForm Me.frmIncoming.MdiParent = Me End If Me.frmIncoming.Show()...
11
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok /...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
19
by: rbrowning1958 | last post by:
Hello, I am confused by dispose etc. and hope someone can set me right. 1. The Dispose(Bool) the IDE generates for a form has nothing to do with IDisposable, right? 2. So when is this called?...
1
by: =?Utf-8?B?U2FpbXZw?= | last post by:
Hello Marc Gravell and Machin. Good Day. Why your not using an Instance in the form and yet your using a New Form? Im using it because I want to open a single form only. If Im using a New...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.