473,397 Members | 2,056 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,397 software developers and data experts.

Form creation and program flow

Greetings!

I am a VB6 programmer just learning .Net. In the VB6 world, I am used to
creating a form, calling "MyForm.Show vbModal", and then assuming in the
next step that information on the form will be complete and available. I
don't see the equivalent construct in .Net. If I call MyForm.Show(), the
form is shown and execution immediately proceeds with the step after the
call to Show(), as though I had used vbModeless in the VB6 world.
Application.Run(MyForm) will show the application's main form. Can I call
that at any time, for any form? I got the impression from the help page
that Application.Run() is just for the main form of the app. What is the
preferred way to get modal display of a form in VB .Net?

Thanks very much!

Rob Richardson
Nov 20 '05 #1
2 1106

"Rob Richardson" <th*****@n2net.net> wrote in message
news:vv************@corp.supernews.com...
Greetings!

I am a VB6 programmer just learning .Net. In the VB6 world, I am used to
creating a form, calling "MyForm.Show vbModal", and then assuming in the
next step that information on the form will be complete and available. I
don't see the equivalent construct in .Net. If I call MyForm.Show(), the
form is shown and execution immediately proceeds with the step after the
call to Show(), as though I had used vbModeless in the VB6 world.
Application.Run(MyForm) will show the application's main form. Can I call
that at any time, for any form? I got the impression from the help page
that Application.Run() is just for the main form of the app. What is the
preferred way to get modal display of a form in VB .Net?

Thanks very much!

Rob Richardson


MyForm.ShowDialog() is what you are looking for...

Lorne
Nov 20 '05 #2
To display a modal form instance use

------------------
Dim objForm as new MyForm ' Where MyForm is the name of your form class
objForm.ShowDialog
------------------

One thing to remember in .net that Forms are just classes like any other
object - you have to create an instance before you can use it. VB6
automatically created the instance for you - .net doesn't.

HTH,

Trev.
"Rob Richardson" <th*****@n2net.net> wrote in message
news:vv************@corp.supernews.com...
Greetings!

I am a VB6 programmer just learning .Net. In the VB6 world, I am used to
creating a form, calling "MyForm.Show vbModal", and then assuming in the
next step that information on the form will be complete and available. I
don't see the equivalent construct in .Net. If I call MyForm.Show(), the
form is shown and execution immediately proceeds with the step after the
call to Show(), as though I had used vbModeless in the VB6 world.
Application.Run(MyForm) will show the application's main form. Can I call
that at any time, for any form? I got the impression from the help page
that Application.Run() is just for the main form of the app. What is the
preferred way to get modal display of a form in VB .Net?

Thanks very much!

Rob Richardson

Nov 20 '05 #3

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

Similar topics

25
by: Steven Bethard | last post by:
So I end up writing code like this a fair bit: map = {} for key, value in sequence: map.setdefault(key, ).append(value) This code basically constructs a one-to-many mapping -- each value that...
4
by: Zork | last post by:
Hi, I am trying to stop object creation (in this case ill use a ball as the object) via use of exceptions. In essence, if the ball does not have an owner, I do not want the ball object created....
3
by: Chris | last post by:
Modal forms are great for locking the user out of non focused forms allowing tight control over program flow, but they have one side effect which user find very irritating i.e. Access cannot be...
1
by: Brett | last post by:
I'd like to have all of my documentation in one place. I use the following for documenting code: - attributes for certain types of documentation - use of the C# generated inline XML...
14
by: foxchan | last post by:
A Newbie question. Is it possible? Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim oNewForm As Form1 'if already create a form...
3
by: EnglishMan69 | last post by:
Hello All, I am using VB2005 Beta 2 in VS 2005 and am running into a small problem. I need to be able to add a picture box to the main form from within a thread. The program goes to a web...
44
by: petermichaux | last post by:
Hi, I have been using the following line of code to create an object called "Serious" if it doesn't already exist. if (Serious == null) {var Serious = {};} This works in the scripts I use...
33
by: Zytan | last post by:
I want to make a zero element array. I know that Nothing is not the same as a zero element array, since I can't get the length of, or iterate through, an array = Nothing. I could make a zero...
15
by: Angelo | last post by:
Hi all, I'm using a FileSystemWatcher to monitor a directory. I want the FSW to pop up my already instantiated but invisible form. However, I'm running into some problems with this. 1) In...
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
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
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...

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.