473,670 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6024
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*****@hotmai l.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
3416
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 dialog. However, my dialog procedure doesn't seem to get a WM_DESTROY message when I click the close button. Also, pressing Alt-F4 does not close my application when the dialog has focus (it does terminate when my main window or another child of...
8
9094
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 can't receive focus)... Can someone tell me what I need to do to make the child form modeless..??? I want to be able to alternate focus between both dialogs... thanks,
1
4241
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 anyone could give me some advice. Basically when I create the modeless dialog, I'm assuming that C# under the covers will be implicitly creating a new thread for the modeless dialog's message pump. Thus I protect the state determiners with a...
0
3175
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()) or the selection is made from, say, a ListBox, no exception is thrown. I have included a simple example below. The error message refers to Unsafe Native Methods, but the code is 100% managed. What is going on ? I am using C#.NET 2003, Standard...
6
3224
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
3334
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 2 - Changing the constructor of the modeless dialog to accept the parent object:" line and go onwards is what I'm trying to do Basically, there is the main form, and then there's the modeless form. I want the modeless form act like a modal form,...
1
2429
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 receive certain data from the server I want to create a new modeless form to show some of that data. But after receiving the data from the socket the modeless dialog does not appear (it seems to be receiving no windows message to update itself,...
8
5459
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 need to display a modeless dialog from the main form which is in Project A and the modeless dialog to be raised is in Project B. After closing the modeless dialog i need to pass a value from modeless dialog to the main form of Project A and also i...
5
1765
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 forms using code like Form frm = new Form1() ; frm.Show() ;
0
8903
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5684
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2800
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.