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

One variable can call many form

Hi All,

I want to ask how to call form with only one variable in VB.Net.
I have 3 form (Form1, Form2 and Form3) and 1 module.
in the module i want to declare public variable to call form for ex:
Public frm as .....

In the Form1 i have two button (btnForm2 and btn Form3) and one
Function.
Public Function callForm(FormName as String)
frm=..............
frm.show()
frm.txtNameForm.text=FormName
End Function

In the Form2 i have one textbox (txtNameForm)
In the Form3 i have one textbox(txtnameForm)

So, if I click btnForm2 it will "Call callForm("Form2"), Form2 will
displayed and txtnameForm="Form2".
And If I click btnForm3 it will "Call callForm("Form3"), Form3 will
displayed and txtnameForm="Form3".

So can anybody help me how to declare the frm variable so it can call
many form.

Thanks b4

Aug 1 '06 #1
2 1317
try something along these lines

Private frm As Form

Private Sub Button1_Click(...)

frm = New Form2
frm.Show()

End Sub

Private Button2_Click(...)

frm = New Form3
frm.Show()

End Sub
hope that helps
--
-iwdu15
Aug 1 '06 #2
Thanks, it works in Windows Application. But when i try it in Smart
Device Application, it's error. Is .Net Framework not support that in
Smart Device?

Thanks

iwdu15 wrote:
try something along these lines

Private frm As Form

Private Sub Button1_Click(...)

frm = New Form2
frm.Show()

End Sub

Private Button2_Click(...)

frm = New Form3
frm.Show()

End Sub
hope that helps
--
-iwdu15
Aug 3 '06 #3

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

Similar topics

10
by: R.G. Vervoort | last post by:
I am using a javafunction (onclick in select) in which i am calling a function in php (thats why i send this to both php and javascript newsgroups). in the onclick i call the function...
5
by: Jim Banks | last post by:
Greetings I'm opening a pop up window with a html form, (in one document) and I want to pass a variable to the html form called from the hyperlink. Here's the code I'm using to pop up the...
7
by: deko | last post by:
I have a function with a number of long loops. While the function is running, I want to be able to click a Stop button and exit the function as quickly as possible. The abbreviated code looks...
7
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
7
by: MgGuigg | last post by:
Hello all, This is my first time posting a question to this forum, so here is hoping I am following protocol. I am scraping the rust off my old Basic programming skills, and have just recently...
1
by: ghobley | last post by:
Hello, I have a Parent form call say MyProjectForm which is inherited, in this I have a variable call MyProjectItemNode of type treenode. I also have an overridable function called SelectNode in...
4
by: Mike TI | last post by:
April 22, 2006 Hi all I want to execute a command stored in a variable, eg I may store: Form1.Show() or Form2.Show()
1
by: sap0321 | last post by:
This should be kindergarten stuff but for some reason I am having trouble with it. I do 99.9% web programming and this is the first windows app i've done in years - probably the first ever in C# ......
20
by: teddysnips | last post by:
Weird. I have taken over responsibility for a legacy application, Access 2k3, split FE/BE. The client has reported a problem and I'm investigating. I didn't write the application. The...
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: 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
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?
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.