954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

silly Q...but i dont knw the answer !!!

hey ppl, i know this is aa really daft Q, but i only started using vb.net this yr and im not that gud at it!

basically i wana know how to go from one form to another using a button, wud it just be sumthin as simple as:

Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

btnSearch = frmSearch

endSub

shelly121
Newbie Poster
17 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

No, you will need to create an object variable for the form you wish to open.

Somthing like this under the button sub should work:

Dim objNewForm as New NewForm()
objNewForm.ShowDialog()

Chester

cpopham
Junior Poster in Training
65 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

Adding to what cpopham said, make a subroutine for one of your buttons like this:

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

objNewForm.ShowDialog()

End Sub

Also make sure you put Dim objNewForm as New Form somewhere near the top. It should be "as New Form" and not "as New NewForm()"

That's in my version at least.

Khishin
Newbie Poster
23 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You