I have 3 forms: Form1, Form2 and Form99. Form1 and Form2 both call Form99.
What statement(s) does Form99 use to determine which form called it (Form1 or Form2).

Form1
Form99.Show

Form2
Form99.Show

Form99

Which form called me?

Thank You.

Public Class frm99
    Public sNameOfForm As String = Nothing

    Private Sub frm99_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MsgBox(sNameOfForm)
    End Sub
End Class

And for all other Forms:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        With frm99
            .sNameOfForm = Me.Name
            .Show()
        End With
    End Sub

Thank you codeorder for you reply. It's just what I needed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.