Post: Need Help With this VB Code
02-22-2011, 01:41 AM #1
-Bane-
Bane Does Work. Like Me.
(adsbygoogle = window.adsbygoogle || []).push({});
Idk how, but I forgot how to use this code.

Here is the Blank Button Press code with no actions when pressed.
        
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


End Sub


But this code is in Form1.vb
and I want it to open Form2.vb when clicked.
What is that code?
I kept trying stuff like:
Show ("Form2")
ect.

Nothing worked. Can someone help please?

02-22-2011, 01:52 AM #2
Originally posted by D33Z3L View Post
Idk how, but I forgot how to use this code.

Here is the Blank Button Press code with no actions when pressed.
        
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


End Sub


But this code is in Form1.vb
and I want it to open Form2.vb when clicked.
What is that code?
I kept trying stuff like:
Show ("Form2")
ect.

Nothing worked. Can someone help please?



If "Form2" has not been delcared, then use this:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Form2 As New Form
Form2.Show()
End Sub



If "Form2" HAS been declared, use this:

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


Enjoy! Happy

The following user thanked aiman119 for this useful post:

-Bane-
02-22-2011, 01:59 AM #3
-Bane-
Bane Does Work. Like Me.
Originally posted by aiman119 View Post
If "Form2" has not been delcared, then use this:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Form2 As New Form
Form2.Show()
End Sub



If "Form2" HAS been declared, use this:

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


Enjoy! Happy


thanks
it worked
02-22-2011, 02:00 AM #4
Originally posted by D33Z3L View Post
thanks
it worked


No problem! Happy

Copyright © 2025, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo