vb controls

Posted on 2003-02-20
Medium Priority
Last Modified: 2010-05-01
I am tyring to implement a VB application for USB and it is giving me simple basic error code, such as variable not defined from one form to other. what am i doing wrong.
For example.. if the variable is in frmtext and i am using in frmtreatment, it gives me error saying variable not defined. I have linked the two forms.
please advise.
Question by:vbArtist
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

muskad202 earned 200 total points
ID: 7989046
i don't know wht u mean by "linked the 2 forms", but here's wht u do, declare the variable as public in frmtext (right at the top), then in the second form, access it as



Expert Comment

ID: 7989497
you need to declare the variable in a module
declare it as something like

public 'variable' as 'variabletype'

Expert Comment

ID: 7990295
muskad202 is correct.

Also, if you add a code module to your project, you can declare a variable as global ("Global gX as Long") and it can be seen from anywhere in your app.  This is helpful if you want to access a variable from many places, like a new form you may add.


Expert Comment

ID: 8901357
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
LVL 49

Expert Comment

ID: 8963978
Moderator, my recommended disposition is:

    Accept muskad202's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month9 days, 12 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question