Click here to Skip to main content
15,922,325 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: multiple forms Pin
Christian Graus25-Feb-07 8:48
protectorChristian Graus25-Feb-07 8:48 
GeneralRe: multiple forms Pin
JUNEYT25-Feb-07 1:21
JUNEYT25-Feb-07 1:21 
Generalits solved Pin
manni_n25-Feb-07 1:45
manni_n25-Feb-07 1:45 
GeneralRe: multiple forms [modified] Pin
TwoFaced25-Feb-07 8:21
TwoFaced25-Feb-07 8:21 
GeneralRe: multiple forms Pin
JUNEYT25-Feb-07 11:49
JUNEYT25-Feb-07 11:49 
GeneralRe: multiple forms Pin
TwoFaced25-Feb-07 14:59
TwoFaced25-Feb-07 14:59 
Generalacceptable answer Pin
JUNEYT25-Feb-07 22:59
JUNEYT25-Feb-07 22:59 
GeneralRe: acceptable answer Pin
TwoFaced26-Feb-07 13:53
TwoFaced26-Feb-07 13:53 
Well forms are classes and you need to create an instance so you can show it or work with it. If another form needs to interact with that form then one way or another it needs to know which instance it's dealing with, because there could be many. If you had a form where only one instance should exist you could create a singleton form. Try looking that term up and you should find some examples. That's certainly another approach which may be appropriate for a given situation. There are also other scenarios. For instance if you didn't hide form1 you wouldn't need to show it again and form2 wouldn't have to know about it. But if that's the way you want it to work then form2 will need to know which instance it should show. Truth be told though it is still possible to use forms the old VB6 way. I'm sure many people would frown upon that and I am not going to encourage it but it's an option. For example create a new project and add a a second form with the default name form2. Replace the code in both forms with the following.
Code for Form1
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form2.Show()
        Me.Hide()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Set the text to the time of creation so we can tell this
        'we are dealing with the same instance
        Me.Text = Now.ToLongTimeString
    End Sub
End Class
Code for Form2
Public Class Form2

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Form1.Show()
        Me.Hide()
    End Sub

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Set the text to the time of creation so we can tell this
        'we are dealing with the same instance
        Me.Text = Now.ToLongTimeString
    End Sub
End Class

GeneralYour solution is not appropriate! Pin
JUNEYT26-Feb-07 23:22
JUNEYT26-Feb-07 23:22 
GeneralRe: Your solution is not appropriate! [modified] Pin
TwoFaced27-Feb-07 9:36
TwoFaced27-Feb-07 9:36 
Questionwhat is 192 bit encryption Pin
onrivman24-Feb-07 22:01
onrivman24-Feb-07 22:01 
AnswerRe: what is 192 bit encryption Pin
Guffa25-Feb-07 1:49
Guffa25-Feb-07 1:49 
Questionevents and delegates in vb.net Pin
Pankaj Garg24-Feb-07 19:31
Pankaj Garg24-Feb-07 19:31 
AnswerRe: events and delegates in vb.net Pin
JUNEYT25-Feb-07 0:50
JUNEYT25-Feb-07 0:50 
QuestionReferential classes in vb.net Pin
Pankaj Garg24-Feb-07 19:27
Pankaj Garg24-Feb-07 19:27 
AnswerRe: Referential classes in vb.net Pin
JUNEYT25-Feb-07 0:59
JUNEYT25-Feb-07 0:59 
GeneralRe: Referential classes in vb.net Pin
amaneet25-Feb-07 1:54
amaneet25-Feb-07 1:54 
GeneralRe: Referential classes in vb.net Pin
JUNEYT25-Feb-07 2:33
JUNEYT25-Feb-07 2:33 
QuestionAuthenticaton mode(Desktop application) Pin
Pankaj Garg24-Feb-07 19:07
Pankaj Garg24-Feb-07 19:07 
Questionoption explicit and option strict Pin
Pankaj Garg24-Feb-07 19:05
Pankaj Garg24-Feb-07 19:05 
AnswerRe: option explicit and option strict Pin
JUNEYT25-Feb-07 0:53
JUNEYT25-Feb-07 0:53 
GeneralRe: option explicit and option strict Pin
amaneet25-Feb-07 1:55
amaneet25-Feb-07 1:55 
GeneralRe: option explicit and option strict Pin
JUNEYT25-Feb-07 2:38
JUNEYT25-Feb-07 2:38 
Questiondouble link list Pin
Pankaj Garg24-Feb-07 19:02
Pankaj Garg24-Feb-07 19:02 
QuestionCustom DataGrid in VB.NET Pin
mariefitz24-Feb-07 14:23
mariefitz24-Feb-07 14:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.