Half of the properties for list box dont show..

gautam89

Registered User.
Local time
Today, 15:39
Joined
Jul 19, 2007
Messages
13
Hi Everyone,

For some strange reason in VB6 it doesn't give you all the properties of a list box. I cannot use the following, perhaps others also that I am unaware of.
Code:
ListBox1.Text
ListBox1.List(i)    ' i is the index number
ListBox1.Clear

Are there any references I am supposed to add to use list boxes? Sorry if this is a stupid question, but I'm not reallly familiar with how this whole references/libraries thing works.

Any help would be appreciated. Thanks!
 
By "doesn't give you," do you mean they don't show up in an intellisense window or they generate errors when you run the code?
 
both... :(
 
Yikes. Don't know. Thought you might have been using a variable dimmed as a base class of the list, in which case your properties would not show up, but code would still run.
Sorry, dude, can't help you.
 
Totally wild guess here, but you say you're using VB6? Not VBA?

If so, could listbox in VB6 be different from listbox in Access?

If you really need to use "Access" listbox in VB6, you probably could try and setting a reference to Access library, but good luck. I doubt this will work.
 
Very sorry for the typo. I am using VBA. I don't have VB6 installed on my computer...

I'm typing VB code behind Access forms.
 
Ok.

Can you get another listbox to behave correctly?

If no other listboxes in the database can return those properties/methods, try listbox in a different database (make a blank database if you need to).

In other word, try and reproduce the behavior.
 
Just tried what you said. Was a good idea, but still the same problem - both in the existing database and in a new database I just created...
 
Do you have another computer with Access? Or at least, can you do a fresh install? This is one more step toward figuring out whether it's the copy of your Access that's borked or if there's something outside Access borking Access up.
 
Just tried it on another computer... It's weird it still doesn't work.

When you type list0. you get the intellisense window. that doesn't show "clear"

But if you continue typing list0.clear it will automatically capitalize and change it to list0.Clear

Then when you run through the line, it gives the error -
Compile Error:
Method or data member not found


Is it something to do with the list box I am dragging and dropping from the toolbar? Am I doing the right one?

Because in all the books I have and many websites it appears that the default is name ListBox1. When I add it to my form, the default name is List0.
 
I can find no evidence (in ACC2000 or on the web) that a property named "Clear" exits in Access, which would be pretty good reason for it not working! Where did you get the idea that it was a property of a list box, and what do you expect it to do?

Also, a listbox has no .text property. This property (available for textboxes and comboboxes) has to do with the value being added to a control as it is being added and before it is saved. Since you can't enter data in a listbox, there's no need for it.
 
Last edited:
VBA is similar to VB6, but similar is not identical! This is particularly true when comes to list boxes, as you've found out! The Properties listed for ActiveX controls in the Properties Box in Form Design View are sometimes not a true reflection of what's available, although the list available inside the VB code editor is, but I've never known the Design View Properties list for any standard Access object to be incorrect.
 

Users who are viewing this thread

Back
Top Bottom