It is now, and there is no change, i havent change anything since i have rebuilt the computer in the code anyway
Main Topics
Browse All TopicsHi Guys i have recently reinstalled VB 6 back on to my computer after a system crash and now when i try to run some of my programs i am getting a cOMPILE eRROR, vARIABLE NOT DEFINED.
The Code i am using is below
Private Sub additem_Click()
Set objLst = ListView1.ListItems.Add(, , Text1.Text)
objLst.SubItems(1) = Text1.Text
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
OK.
For the most efficient/bug free program, all of your variables must be declared. By using the "Option Explicit" keyword at the top of your Forms/Modules, it forces all variables to be declared. If, in the settings for VB (Tools -> Options -> Require Variable Declaration) is checked, it will automatically place the "Option Explicit" keyword at the top of your Forms/Modules, which forces you to declare your variables.
You could just remove the "Option Explicit" at the top of each Form/Module, this would correct this issue - but you should declare everything.
So...I would use
Private Sub additem_Click()
Dim objLst as Object
' This declares objLst as an object
Set objLst = ListView1.ListItems.Add(, , Text1.Text)
objLst.SubItems(1) = Text1.Text
But, if none of your variables are declared - then it could take a while to declare all of them. So, if you need to get it running really quickly - then just remove the "Option Explicit" and start declaring your variables.
Adding an "Object Explicit" later is a great way to determine if you missed a variable declaration.
'...rest of your code
Business Accounts
Answer for Membership
by: bingiePosted on 2007-02-16 at 19:53:02ID: 18553838
Are you variables all defined?
Do you have "Option Explicit" at the top of your forms/modules now, and didn't have it there before?
Also, check Tools -> Options -> Require Variable Declaration
Is that enabled?