One variable can call many form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • khokimfang@gmail.com

    #1

    One variable can call many form

    Hi All,

    I want to ask how to call form with only one variable in VB.Net.
    I have 3 form (Form1, Form2 and Form3) and 1 module.
    in the module i want to declare public variable to call form for ex:
    Public frm as .....

    In the Form1 i have two button (btnForm2 and btn Form3) and one
    Function.
    Public Function callForm(FormNa me as String)
    frm=........... ...
    frm.show()
    frm.txtNameForm .text=FormName
    End Function

    In the Form2 i have one textbox (txtNameForm)
    In the Form3 i have one textbox(txtname Form)

    So, if I click btnForm2 it will "Call callForm("Form2 "), Form2 will
    displayed and txtnameForm="Fo rm2".
    And If I click btnForm3 it will "Call callForm("Form3 "), Form3 will
    displayed and txtnameForm="Fo rm3".

    So can anybody help me how to declare the frm variable so it can call
    many form.

    Thanks b4

  • iwdu15

    #2
    RE: One variable can call many form

    try something along these lines

    Private frm As Form

    Private Sub Button1_Click(. ..)

    frm = New Form2
    frm.Show()

    End Sub

    Private Button2_Click(. ..)

    frm = New Form3
    frm.Show()

    End Sub


    hope that helps
    --
    -iwdu15

    Comment

    • khokimfang@gmail.com

      #3
      Re: One variable can call many form

      Thanks, it works in Windows Application. But when i try it in Smart
      Device Application, it's error. Is .Net Framework not support that in
      Smart Device?

      Thanks

      iwdu15 wrote:
      try something along these lines
      >
      Private frm As Form
      >
      Private Sub Button1_Click(. ..)
      >
      frm = New Form2
      frm.Show()
      >
      End Sub
      >
      Private Button2_Click(. ..)
      >
      frm = New Form3
      frm.Show()
      >
      End Sub
      >
      >
      hope that helps
      --
      -iwdu15

      Comment

      Working...