• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

vb controls

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.
0
vbArtist
Asked:
vbArtist
1 Solution
 
muskad202Commented:
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

frmtext.variablename

----------
muskad202
0
 
HanrahaNCommented:
you need to declare the variable in a module
declare it as something like

public 'variable' as 'variabletype'
0
 
miloweCommented:
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.

milowe
0
 
CleanupPingCommented:
vbArtist:
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?
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

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

DanRollins -- EE database cleanup volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now