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

Modal forms--- How?

Can anybody help?
I have just started using .net after moving over from VB5. I am trying to move between 2 forms without starting any procedures again. In VB5 the simple form1.show, and form2.hide would work but this doesnt work in .net. I have found a resource that says you must declare it i.e
Dim form1 As New Form1()
form1.Show()
this works but starts a new procedure as it is declaring form1 as a new form1 effectively starting the procedure again and losing any information that has be input. I have also found a resource which says you simply have to type form1.showdialog() but this does not work either.
Please help?
Thanks

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 20 '05 #1
2 4158
Hi,

Place a variable in a module of the form type.

Public frm1 as new Form1

When you want to call it use frm1.Show(). Remember that if you
call a form that is unloaded you will get an error.

Ken
----------
"claire fox" <fo*******@hotmail.com> wrote in message
news:OV**************@tk2msftngp13.phx.gbl...
Can anybody help?
I have just started using .net after moving over from VB5. I am trying to move between 2 forms without starting any procedures again. In VB5 the
simple form1.show, and form2.hide would work but this doesnt work in .net. I
have found a resource that says you must declare it i.e Dim form1 As New Form1()
form1.Show()
this works but starts a new procedure as it is declaring form1 as a new form1 effectively starting the procedure again and losing any information
that has be input. I have also found a resource which says you simply have
to type form1.showdialog() but this does not work either. Please help?
Thanks

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &

ASP.NET resources...
Nov 20 '05 #2
Hello,

"claire fox" <fo*******@hotmail.com> schrieb:
I have just started using .net after moving over from VB5.
I am trying to move between 2 forms without starting any
procedures again. In VB5 the simple form1.show, and
form2.hide would work but this doesnt work in .net.


\\\
Public Class Main
Private Shared m_MyForm1 As Form1
Private Shared m_MyForm2 As Form2

Public Shared Sub Main()
m_MyForm1 = New Form1()
m_MyForm2 = New Form2()
m_MyForm1.Show()
Application.Run()
End Sub

Public Shared ReadOny Property MyForm1() As Form1
Get
Return m_MyForm1
End Get
End Property

Public Shared ReadOny Property MyForm2() As Form2
Get
Return m_MyForm2
End Get
End Property
End Class
///

You can use 'Application.Exit' to exit the application. Everywhere in the
project, you can access 'Form1' by typing 'Main.MyForm1' and 'Form2' by
typing 'Main.MyForm2'. Notice that this is not the best OOP design, but it
works.

--
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

1
by: Gwyn | last post by:
I have a burning desire (need) to dislay either modal forms or something equivalent within an MDI based application... Except I can't! I can use ShowDialog() but the form being shown cannot...
4
by: news | last post by:
Not really sure if this is a javascript problem or C# - sorry if in wrong place. Modal Forms Question in Web Application I have two web forms: Form1 and Form2 Form1 calls Form2 using...
2
by: D Cameron | last post by:
I'd like to be able to make a full screen form in one of my apps inescapable: disable the Start button, Alt-Tab etc. until my application closes the form. I seem to remember VB3.0 distinguishing...
0
by: Hector | last post by:
I have a ComboBox set up in a non-modal form. When a selection is made from the ComboBox, the handler code closes the form, but then the system crashes because of an unhandled NullReferenceException....
3
by: Sarika | last post by:
I have some questions regarding Modal forms and would appreciate if someone could clarify my understanding. (a) I observed that the modal form's Form_Closing event is generated if I set the...
4
by: Oenone | last post by:
I'm continuing work on getting my VB6 plug-ins to work within my VB.NET application and am making reasonable progress. I've just experienced an error that has me a bit worried though. Many of...
2
by: Mike | last post by:
Hi, I'm having a problem with modal forms on windows. I've written a very short test program, with a main window and a form called from the main window. The form is set to modal with...
0
by: Peter Anthony | last post by:
I recently discovered an interesting aspect of Forms which are launched as modal forms via ShowDialog. As it turns out, if the modal form is visible and its Hide( ) method is performed it...
1
by: Claire | last post by:
Hi, I've a problem. Our app has a main screen, a user logs in to the system using a smart card. After login, several loops through a switch statement are performed to check for certain...
2
by: diogenes | last post by:
I have created many shortcut/popup (aka context, or right-click) menus for my application - instead of toolbars or standard drop-down menus. Within my custom menu, I am using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
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,...

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.