473,394 Members | 1,718 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.

Lauching a form from another form

Windows form application

I have an accounting application, the main form of that application can
be launched from other application passing the account number or it
can be started
as a standalone application. If it is started as a standalone
application It shoud prompt a dialog box asking for account number.
if the account number is valid it will launch a main form passing the
account number

I currently have a Sub Main(ByVal Args() As String) and I am passing
command line arguments it it is open from the other application

And no argument is passed I open up account number form but the thing
is as soon as I close the account number form it closes my entire
application.

any solution?

Jul 13 '06 #1
4 1073
fortunatly if your using 2005, theres a simple solution, in your project
properties theres an option of Exit Application When...and you can select
When First Form Closes or When last Form Closes....so pick when last form
closes.

if your using 2003....well i never quite took the time to figure out how to
stop that from happening....
--
-iwdu15
Jul 13 '06 #2
When you use Sub Main (you must have to uncheck) use application
framework. so you do not have shutdown mode optioins available.

Jul 13 '06 #3
it may nto be the best method, but if your starting up from Sub main, make
your form variable a global variable, then in your form closing event, hide
your form. when you want to exit your app in other forms, say

Application.Exit()

and i know your not supposed to do this...but i forget the other way of
preventing this action
--
-iwdu15
Jul 13 '06 #4

c_shah wrote:
Windows form application

I have an accounting application, the main form of that application can
be launched from other application passing the account number or it
can be started
as a standalone application. If it is started as a standalone
application It shoud prompt a dialog box asking for account number.
if the account number is valid it will launch a main form passing the
account number

I currently have a Sub Main(ByVal Args() As String) and I am passing
command line arguments it it is open from the other application

And no argument is passed I open up account number form but the thing
is as soon as I close the account number form it closes my entire
application.

any solution?
I wrote a Sub Main based VB app (with VS2005) that opens a couple of
forms using the Form.Show method, and when those forms close, the app
doesn't end. And the code later opens the main form with an
Application.Run(mainform) command.

If the Sub Main code comes to the End Sub, the app will close. But the
Application.Run method keeps the app alive until the form referenced in
the .Run method is closed. At least that's how it works for me.

Jul 13 '06 #5

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

Similar topics

2
by: Thang Nguyen | last post by:
Hi, my page contains an applet. When I click on a link on the page, the applet will be launched.Now I need my page can be automatically closed when I close my applet.I can call the script from my...
4
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a form with multiple pages on it. There is one text field on the third page of the form that I need the user to complete before leaving the form or moving...
2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
6
by: MP | last post by:
Hello I want to have a public property (and Brows able) in one control, I use this code: public System.Windows.Forms.Form recordForm get { return _recordForm;} set {_recordForm = value;}
3
by: Micus | last post by:
Greetings, I need to execute 2 applications from an application or batch file. The first app launched has the user enter a product key and the app's exit code will be 0 (failed) or 1...
18
by: Colin McGuire | last post by:
Hi - this was posted last weekend and unfortunately not resolved. The solutions that were posted almost worked but after another 5 days of working on the code everynight, I am not further ahead....
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...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
5
by: Neil | last post by:
"lyle" <lyle.fairfield@gmail.comwrote in message news:48c3dde7-07bd-48b8-91c3-e157b703f92b@f3g2000hsg.googlegroups.com... Question for you. I'm doing something similar, only, instead of opening...
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:
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
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
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.