Results 1 to 6 of 6

Thread: 2 forms?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    1

    2 forms?

    Hi there people,
    I am a newbie in VB.net attempting to create a mobile application but am having difficulties trying refresh a page with values.

    Case scenario:

    2 forms A & B.
    In within form A - there is a NEXT button. When a user clicks on it, it will bring the user to Form B.

    Vice versa, on form B as well there is a BACK button to bring the user back to Form A. What I am trying to achieve here is that, when user clicks NEXT button (Form A) it brings user to Form B and executes whatever code you have in Form B but if the user clicks on back button to Form A; the code would not execute the 2nd time the user click on the NEXT button.

    My code is rather or should i say very simple.

    CODE in Form A:
    frmB.show()
    me.hide()

    CODE in Form B:
    frmA.show()
    me.hide()

    But I don't think the showing and hiding is doing the job. Is there a line of code to help me to perform the calculations again in Form B everytime I click on the NEXT button in Form A?

    Please advice.
    Thanks in advance.

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: 2 forms?

    Quote Originally Posted by lynkxx
    Hi there people,
    I am a newbie in VB.net attempting to create a mobile application but am having difficulties trying refresh a page with values.

    Case scenario:

    2 forms A & B.
    In within form A - there is a NEXT button. When a user clicks on it, it will bring the user to Form B.

    Vice versa, on form B as well there is a BACK button to bring the user back to Form A. What I am trying to achieve here is that, when user clicks NEXT button (Form A) it brings user to Form B and executes whatever code you have in Form B but if the user clicks on back button to Form A; the code would not execute the 2nd time the user click on the NEXT button.

    My code is rather or should i say very simple.

    CODE in Form A:
    frmB.show()
    me.hide()

    CODE in Form B:
    frmA.show()
    me.hide()

    But I don't think the showing and hiding is doing the job. Is there a line of code to help me to perform the calculations again in Form B everytime I click on the NEXT button in Form A?

    Please advice.
    Thanks in advance.
    Hi,

    Showing and hiding does do the job.
    But I should change your code into this:

    CODE in Form A:
    Code:
    Dim frmB As New Form2
    frmB.show()
    me.hide()
    CODE in Form B:
    Code:
    Dim frmA As New Form1
    frmA.show()
    me.hide()
    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  3. #3
    Addicted Member Abrium's Avatar
    Join Date
    Feb 2007
    Location
    The Great State of Texas
    Posts
    205

    Re: 2 forms?

    As long as you do not have code tied to the _click event for the back button then no code should be executed except for the hiding and showing of the individual forms.
    Abrium
    Asking the beginners questions so you don't have to!
    If by chance hell actually froze over and I some how helped you... Please rate.

  4. #4
    Member
    Join Date
    Dec 2006
    Posts
    36

    Re: 2 forms?

    Sorry for butting in, but sparrow1, if the forms are already named frmA and frmB, what would the point of "Dim frmA" etc?

  5. #5
    Addicted Member Abrium's Avatar
    Join Date
    Feb 2007
    Location
    The Great State of Texas
    Posts
    205

    Re: 2 forms?

    Dim'ing the form creates an instance of the form in memory and assigns it an address to the object variable.
    Abrium
    Asking the beginners questions so you don't have to!
    If by chance hell actually froze over and I some how helped you... Please rate.

  6. #6
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: 2 forms?

    Quote Originally Posted by BuddaT
    Sorry for butting in, but sparrow1, if the forms are already named frmA and frmB, what would the point of "Dim frmA" etc?
    Hi,

    I've tested in VB.net 2003 and then you need to declare the forms because you need a Reference to a non-shared member requires an object reference.

    Hope it helps,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

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