WinForms Parameters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Viswanathan S

    #1

    WinForms Parameters

    Hi All,

    How to pass parameter to winform. From a menu there are several items. When
    click on any item a form will be open. For opening a form i am giving some
    parameters to the form.

    When i use global variables, the value changed when a new form is opened. Is
    there any other way to pass window parameters?


    Thanks in Advance
    S. Viswanathan


  • Crouchie1998

    #2
    Re: WinForms Parameters

    How do you want to pass them?

    Do you want to transfer text for example from a parameter declared in form 1
    to a textbox/label on form 2?

    Microsoft doesn't recomment using global variables, which is in contrast to
    the old VB 6 where they did tell people to use it.

    Answer my two initial questions & I or anyone else will do our best to help
    you

    Crouchie1998
    BA (HONS) MCP MCSE


    Comment

    • Cor Ligthert

      #3
      Re: WinForms Parameters

      Viswanathan,

      A form is a class, you can pass in the normal way that you pass information
      to the instanced object to do that.

      One is because you have in your form class created a sub new and than you
      can do
      Something as
      Public sub New(byval myparama as integer, byval myparamb as integer)
      myPrivateValueA = myparma
      myPrivateValueB = myparmb
      End sub
      And than you do

      Dim MyForm = MyFormClass(myp arameterx, myparametery)

      Or you have public properties in your form and than you can before you do
      the show set those as
      MyForm.myPublic PropertyA = myparama
      MyForm.publicPr opertyB = myparamb

      I hope this helps,

      Cor


      Comment

      • Chad Z. Hower aka Kudzu

        #4
        Re: WinForms Parameters

        "Viswanatha n S" <visu@ewaksoft. com> wrote in
        news:eFmXBUidFH A.796@TK2MSFTNG P09.phx.gbl:[color=blue]
        > How to pass parameter to winform. From a menu there are several items.
        > When click on any item a form will be open. For opening a form i am
        > giving some parameters to the form.
        >
        > When i use global variables, the value changed when a new form is
        > opened. Is there any other way to pass window parameters?[/color]




        --
        Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
        "Programmin g is an art form that fights back"

        Make your ASP.NET applications run faster

        Comment

        Working...