Results 1 to 5 of 5

Thread: maybe this is a dumb ?

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2000
    Posts
    53

    maybe this is a dumb ?

    How do you navigate between webforms in vb.net in a project I dont see any way to show or hide them and I dont see anyone to access them as object and I dont see any submit button. Maybe im jsut missing something.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    with webform controls..add an on_click attribute with a function to call to a button

    <asp:button name="button1" value="click" on_click="sub1" runat="server"/>


    then just put the function withing a script tag

    <script language="VB" runat="server">

    Public Sub sub1()

    End Sub

    </script>

    you can access the objects by there name in the sub..like if you have a textbox named text1


    a = Text1.Text

    web forms are event driven now..when the on_click is fired the page is reloaded from the web server calling the sub you state.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304

    navigating between forms

    Oops upon reading the query again I see it was web forms not win forms, anyway I'll leave the post as it stands


    Yes, it had me scratching my head as well, now I don't know if this is the best way or not, but it does at least work

    'Menu item Customers: Add
    Dim AddCustomer As New AddCustomer()

    AddCustomer.Show()
    Me.Visible = False

    I have a main menu screen and another form call AddCustomer

    then coming back from the AddCustomer Form, I put in:

    In the click button event

    .the name of my main menu form

    Dim Chelwood As New Chelwood()
    Chelwood.Show()

    Me.Close()

    closing the application is a pain as well, in fact I ended up writing this:
    in the click button event for my logout function

    Me.Close()

    End

    Now I'm prettry much a newbie at this myself, so if there are better ways of doing, then please someone else post as well

    Hope this helps and it least it does work

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2000
    Posts
    53
    Ill take a look at this at work monday. I think the way IIS appliations handled things with pages was a bit easier to understand. How would you make a call to a second web form in a project.

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2000
    Posts
    53

    I found the answer

    There are two ways that I know of navigating through webforms, first way is to remove the runat server tag from the form then this will work like a normal html form if u dont not do this it will always postback to the however if you do do this then your page wont postback on any controls you make.
    The other way is to use response.redirect(url) this will then take you to the next page you want to go to If any one else has a better way to do this or whatever please post

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width