DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Passing parameters to a form

  1. #1
    Rune Bivrin Guest

    Re: Passing parameters to a form

    "rguti" <royguti@bellsouth.net> wrote in news:3dbff65f$1
    @tnews.web.devx.com:

    > How do I pass parameters to a form?
    >
    >
    >


    Most straight-forward way is to define a constructor with parameters:

    Public Sub New(Byval SomeParam As String, Byval SomeOtherParam As Integer)

    MyBase.New()

    m_SomeVariable = SomeParam
    m_SomeOtherVariable = SomeOtherParam

    End Sub

    --
    Rune Bivrin
    - OOP since 1989
    - SQL Server since 1990
    - VB since 1991


  2. #2
    rguti Guest

    Passing parameters to a form

    How do I pass parameters to a form?



  3. #3
    rguti Guest

    Re: Passing parameters to a form

    Thanks for your help and excuse my ignorance, I'm very new at this:

    So I put this code on the Declarations, right? Basically the MyBase.New() is
    the entry point?

    Let's say I want to pass 2 parameters:

    I call it like this?

    Me.Myform.Show(Parameter1,Parameter2)



    "Rune Bivrin" <rune@bivrin.com> wrote in message
    news:Xns92B7A8A292CB1runebivrincom@209.1.14.29...
    > "rguti" <royguti@bellsouth.net> wrote in news:3dbff65f$1
    > @tnews.web.devx.com:
    >
    > > How do I pass parameters to a form?
    > >
    > >
    > >

    >
    > Most straight-forward way is to define a constructor with parameters:
    >
    > Public Sub New(Byval SomeParam As String, Byval SomeOtherParam As Integer)
    >
    > MyBase.New()
    >
    > m_SomeVariable = SomeParam
    > m_SomeOtherVariable = SomeOtherParam
    >
    > End Sub
    >
    > --
    > Rune Bivrin
    > - OOP since 1989
    > - SQL Server since 1990
    > - VB since 1991
    >




  4. #4
    Rune Bivrin Guest

    Re: Passing parameters to a form

    The code I showed should be in the form you wish to show. Let's call that
    class ParameterForm.

    You can then call it from anywhere else like this

    Dim frmParams as new ParameterForm("Try this", 17)
    frmParams.Show()


    There are a multitude of variations on this theme. You can add the
    parameters to a ShowWithParameters() method, or create a static method
    that both creates an instance and shows it.


    --
    Rune Bivrin
    - OOP since 1989
    - SQL Server since 1990
    - VB since 1991

    "rguti" <royguti@bellsouth.net> wrote in
    news:3dc00f2a$1@tnews.web.devx.com:

    > Thanks for your help and excuse my ignorance, I'm very new at this:
    >
    > So I put this code on the Declarations, right? Basically the
    > MyBase.New() is the entry point?
    >
    > Let's say I want to pass 2 parameters:
    >
    > I call it like this?
    >
    > Me.Myform.Show(Parameter1,Parameter2)
    >
    >


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center