CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: variables

  1. #1
    Join Date
    Oct 1999
    Location
    Nova Scotia Canada
    Posts
    3

    variables

    I am trying to write a program which uses several values that the user inputs into a combo box or text box. They do this in the beginning and then these are saved and used throught the program in other windows of the program. For example the user will select thier user name from the main window of the program in a combo box and then this will be stored and used when ever they go to another part of the program which may happen to be in another window of the program. The problem is that I can read this variable from the same window and have the program use it, but when I go to another window or child form, it doesn't work. I have declared this variable as a public variable, but this doesn't seem to work. If you can give me any help this would be great thanks.


  2. #2
    Join Date
    Jun 1999
    Location
    virginia
    Posts
    16

    Re: variables

    Use a module to declare public variables. The public variable works in the form however there is a trick to getting it. If your form is Form1 and your variable is UserName then to use it in another form you would have to use Form1.UserName. However if UserName is in a module then no prefix is needed.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured