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

Display modeless form from Sub Main

My project starts with Sub Main and then needs to display
a modeless form.
From some reason the application closes it self after
calling the Show method.
How can I avoid the application from being closed.
By the way in VB6 there is no problem to do it.
This is the code I have:

Option Explicit On

Module Module1

Public f1 As New Form1()

Sub main()
f1.Show()
End Sub
End Module

Nov 20 '05 #1
2 6015
Hi Rami,

Sub main()
f1.Show()
Application.Run
End Sub

Application.Run will start the message pump going so that windows in the
thread (ie f1) have a working message queue.

Regards,
Fergus
Nov 20 '05 #2
Hello,
"Rami" <ra*****@hotmail.com> schrieb:
My project starts with Sub Main and then needs to display
a modeless form.
From some reason the application closes it self after
calling the Show method.
How can I avoid the application from being closed.
By the way in VB6 there is no problem to do it.
This is the code I have:

Option Explicit On

Module Module1

Public f1 As New Form1()

Sub main()
f1.Show()
End Sub
End Module


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

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3

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

Similar topics

3
by: Rikkert | last post by:
I can't get my custom-made modeless dialog box (Visual C++.net Win32) to respond to clicking the close button or pressing Alt-F4. I am using the IsDialogMessage to check if messages are for my...
8
by: vince | last post by:
I have a windows app whose main dialog contains a button that launches a form. I've tried using Form.Show() to have it launch as a modeless form, but it behaves as if it's modal (i.e. parent form...
1
by: Carmine | last post by:
I'm currently writing a small program that churns on a repetitive task while displaying a progress & cancel modeless dialog. I've been having problems due to threadlocking, and I was wondering if...
0
by: Andrew | last post by:
I get a Null Reference Exception if I close a modeless form (that is, a form displayed using Show()) when a selection is made from a ComboxBox. If the form is modal (displayed using ShowDialog())...
6
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
2
by: Legendary Pansy | last post by:
Hello, I'm trying to accomplish the impossible by trying to do something equivalent of this example found here http://www.c-sharpcorner.com/Code/2003/Dec/DialogTutorial.as Starting with "Listing...
1
by: andrew | last post by:
Hi there, I'm having a problem with a modeless form in my app. I have a main form in my app and a socket that waits on data from a server (I use BeginReceive/EndReceive for that) and when I...
8
by: proit_123 | last post by:
I am working on a windows forms application and have the following requirement. I have two projects in my application Project A and Project B. And Project A has the reference of Project B. I...
5
by: PGP | last post by:
Sorry i asked the same question yesterday but did a bad job on describing the issue so here is a better description. This is in .NET Compact Framework. I have a form which creates modeless...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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,...
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...
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.