Solved

linking to a new from on vb.net

Posted on 2007-04-11
10
177 Views
Last Modified: 2010-04-23
vb.net i want to link a button to a new form on the same project to another form on the same project what code can i use to do this
0
Comment
Question by:tryokane
  • 5
  • 3
  • 2
10 Comments
 
LVL 8

Expert Comment

by:doraiswamy
ID: 18889790
by link, do you mean, when you click this button, it should raise an event on the other form?

0
 
LVL 2

Author Comment

by:tryokane
ID: 18889805
no i mean i just want to click on the button and go to that form
0
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 100 total points
ID: 18889827
Hi tryokane;

Not sure what you mean. The following code when placed in a button click event will create a form of type MyNewForm.

    Dim nForm As New MyNewForm
    nForm.Show()

If this is not what you want please let me know.

Fernando
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 2

Author Comment

by:tryokane
ID: 18889870
i created another folder and a form in it, now i want to link to that form
0
 
LVL 63

Assisted Solution

by:Fernando Soto
Fernando Soto earned 100 total points
ID: 18889913
Hi tryokane;

This should do what you want

    Private nForm As MyNewForm = Nothing

    Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click

        If nForm Is Nothing Then
            nForm = New MyNewForm
            nForm.Show()
        Else
            ' Give the form nForm the focus
            nForm.Activate()
        End If


Fernando
0
 
LVL 8

Assisted Solution

by:doraiswamy
doraiswamy earned 25 total points
ID: 18889921
I think you mean you want to use a form in another project at design time.
Yes that is possible.
Right click on your project name in the Solution Explorer, select Add Existing item, and browse to the folder where the other form is.
0
 
LVL 2

Author Comment

by:tryokane
ID: 18890024
I actually want to do something like this

button1_Click
GoTo(A Form i created)
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 18890079
You need a reference to the form you created and then do the following.

    ReferenceToForm.Activate()
0
 
LVL 2

Author Comment

by:tryokane
ID: 18890115
any code samples on this?
0
 
LVL 2

Author Comment

by:tryokane
ID: 18890849
thx solved it though
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question