w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Code linking a form back to previous form in Windows Forms

What happening is most likely you already closed your form and can't open it again.

Assuming, you have both instances well and alive

In Form2 you should have

me.Hide()
Form3.Show()

And In Form3 you should have

me.Hide()
Form2.Show()

It can be something like this

shared sub Main
    dim f2 as new Form2()
    dim f3 as new Form3()

    f2.Next = f3
    f3.previous = f2

end sub

To link forms you creating properties, Next and Previous And then use that as way to operate the form that should open

In form code do

private sub BtnNext_Click(....).....
    Me.Hide()
    Me.Next.Show()
End Sub

and the same way for the previous. If you have wizard, you could chain all your forms this way. and of course, to accomplish this, minimum, you need an interface that contracts your forms to implement Properties Next and Previous or you can have a base class with implementation of the buttons and properties and then it will all work.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.