troubleshooting Question

Moving between forms

Avatar of janjuama84
janjuama84 asked on
Visual Basic.NET
4 Comments1 Solution228 ViewsLast Modified:
I havee 5 forms.

1. Main form with "ok" button
2. Form 1 with next button
3. Form 2 with next and previous button
4. Form 3 with next and previous button
5. Form 4 with next and done button


If user puts relavent information in "main form" he goes to form1 then and thus can enter relavent information between form1-form4. During that period if the user moves between form the values input are preserved. When the done button is clicked on form4 user goes back to mainform with an option to "add another record". Now here is my problem on mainform when user clicks on "ok" button, the first form comes as blank, however rest all the rest will show the same values that were typred in for previous record. And this happens for form2,3 and 4 all use previous values typed in for last record. I need it to be coming out blank. How can i do that? The code i am using isbelow.





Module Module1
    Public f1 As new Form1
    Public f2 As New Form2
    Public f3 As New Form3
    Public f4 As New Form4

End Module

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        f1 = Me
    End Sub

    Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        Me.Hide()
        f2.Show()
    End Sub

End Class

Public Class Form2
    Inherits System.Windows.Forms.Form

    Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        Me.Hide()
        f3.Show()
    End Sub

    Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click
        Me.Hide()
        f1.Show()
    End Sub

End Class

Public Class Form3
    Inherits System.Windows.Forms.Form

    Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
        Me.Hide()
        f4.Show()
    End Sub

    Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click
        Me.Hide()
        f2.Show()
    End Sub

End Class

Public Class Form4
    Inherits System.Windows.Forms.Form

    Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrev.Click
        Me.Hide()
        f3.Show()
    End Sub

    Private Sub btnDone_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDone.Click
        ' access the public, global variables f1, f2, f3 and f4 here
        ' to save all the data...

     
    End Sub

End Class

 

ASKER CERTIFIED SOLUTION
Mike Tomlinson
High School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros