Passing variables between forms


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Passing variables between forms

  1. #1
    Craig Jewiss Guest

    Passing variables between forms


    Hi

    I have a login form. Once I've confirmed the login I want my main form to
    use the login name and password for later database connections. I've tried
    declaring the username and password as public variables, but I'm obviously
    doing something wrong. My main form recognises the variables (it puts capitals
    in the variable names for me) but the values are always empty strings.

  2. #2
    Colin McGuigan Guest

    Re: Passing variables between forms

    Craig Jewiss wrote in message <38d0686b@news.devx.com>...
    >
    >Hi
    >
    >I have a login form. Once I've confirmed the login I want my main form to
    >use the login name and password for later database connections. I've tried
    >declaring the username and password as public variables, but I'm obviously
    >doing something wrong. My main form recognises the variables (it puts

    capitals
    >in the variable names for me) but the values are always empty strings.


    a) You're probably not using Option Explicit at the top of your forms. You
    should.

    b) You need to preface the variable with the name of the form; eg, if your
    login form is called FLogin, you'd need to use 'FLogin.UserName' and
    'FLogin.Password'

    --
    Colin McGuigan




  3. #3
    Craig Jewiss Guest

    Re: Passing variables between forms


    Colin

    You were spot on with point b). Thanks.

    "Colin McGuigan" <colin@chicor.com> wrote:

    >a) You're probably not using Option Explicit at the top of your forms.

    You
    >should.
    >
    >b) You need to preface the variable with the name of the form; eg, if your
    >login form is called FLogin, you'd need to use 'FLogin.UserName' and
    >'FLogin.Password'
    >
    >--
    >Colin McGuigan
    >
    >
    >



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