• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

Showing next aspx page

I'm new to VB.NET and in VB6 I used to write this to go to the next form.

Private Sub Button1_Click


End Sub

But in VB.NET that doesn't work.

I have a aspx page called Main.aspx and I have a button named button1, what code do I write so that when I click on button1 it goes to the next aspx page called "search.aspx"?
  • 2
1 Solution
with .NET there is no such things as the VB6 Forms collection.  YOu must create an instance of the form you want to use, sort of like this:

Private Sub Button1_Click(ByVal sender as Object, ByVal e as System.EventArgs)

   Dim frm2 as New Form2

   frm2.Show vbModal

End Sub
and ASP.NET is NOTHING at all like that.  to move to another ASP.NET page, you use:


and NOT form.Show

On the Web Form, after placing the Command Button, simply double-click on teh copmmand button, and then add this line to the Click event handler in the code-behind.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now