Error 380 (VB6)

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Error 380 (VB6)

Post by D Willett »

Hi.
I've inherited a project where a combobox listindex is set to 0 on form load.
If I import the form to within my project and try to run the code I get Error 380 Invalid property value (-1)

I'm confused why the inherites project does set the value to 0 but within my project I get the error??

Anyone else dealt with this in the past?

Thanks
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78232
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Error 380 (VB6)

Post by HansV »

Hi Dave,

Has the combo box been populated when you try to set the list index to 0? If the combo box is still empty at that point, trying to set the list index would generate the error that you see.
Best wishes,
Hans

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Error 380 (VB6)

Post by D Willett »

Hi Hans
The imported form has a load event which calls:-

cmbError.ListIndex = 0

and a class module contains:

Set vbQRObj = New vbQRCode

Select Case cmbError.ListIndex
Case 0
vbQRObj.ErrorLevel = qrLevelL
Case 1
vbQRObj.ErrorLevel = qrLevelM
Case 2
vbQRObj.ErrorLevel = qrLevelQ
Case 3
vbQRObj.ErrorLevel = qrLevelH
End Select

Which loads fine in the inherited form, nothing has changed on using the form within my project.
I can populate the combo manually:

cmbError.Additem "ZZZ" or cmbError.Additem 0

Which stops the error occuring, but then the Select case ignores the content???
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78232
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Error 380 (VB6)

Post by HansV »

Merely adding an item doesn't set the list index (it will still be -1), but after the combo box has been populated using AddItem, you can execute

cmbError.ListIndex = 0
Best wishes,
Hans

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Error 380 (VB6)

Post by D Willett »

Cheers Hans. I'll give that a go.
Kind Regards
Cheers ...

Dave.