borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (All possible combination of number)Next Topic (how to send a simple file from a client to server by using winsock) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Please help me, i'm a novice
Poster Message
wickywills
Level: Guest


icon Please help me, i'm a novice

I am creating a form for college which has a list of all the college shop products. From this list the user can select the item they want to buy. After a few more options, the form is then printed out. I have done most of the code but when i try to run it i get the following error: "User-Defined Type not defined". As i am only a novice, i hate all sorts of errors. The error appears over the following area of my code:

Private Sub lsvStock_ItemClick(ByVal Item As MSComctlLib.ListItem)
    'print these options to the labels
    lblSelectedName.Caption = Item.SubItems(1)
    lblSelectedPrice.Caption = Item.SubItems(2)
    
    txtQuantity.Text = 1
    txtQuantity_Change
End Sub

Somebody please help me. Please also note that my knowledge of vidual basic is limited so go easy on me please

03-06-2003 at 03:27 PM
| Quote Reply
doofusboy
Level: Scholar

Registered: 13-05-2003
Posts: 30
icon Re: Please help me, i'm a novice

It would seem that MSComctlLib.ListItem is not a valid datatype in VB (like string, long, integer, etc).

03-06-2003 at 03:39 PM
View Profile Send Email to User Show All Posts | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: Please help me, i'm a novice

Syntax appears fine, you are definately using the listview control?.  

Theres a good demo of a listview control at

www.developerfusion.com/show/166/

Oh and by the way its "Visual" Basic

Cheers Steve

03-06-2003 at 04:18 PM
View Profile Send Email to User Show All Posts | Quote Reply
~Bean~
Level: VB Guru


Registered: 07-04-2003
Posts: 488
icon Re: Please help me, i'm a novice

hhhmmmm... I have run into some similar errors/problems when using MDAC (data access componenets, e.g., ADO), but never with any of the Windows Common Controls...

quote:
doofusboy said
It would seem that MSComctlLib.ListItem is not a valid datatype in VB (like string, long, integer, etc).



Actually, once you add the windows common controls to your project the "MSComctlLib.ListItem" IS a valid type (in fact, that piece of code is added automatically by VB). You can always test this (valid data types) by temporarily adding something like this to your declarations...
Public lstItem As MSComctlLib.ListItem

(as soon as you type the "As" VB should list the Types/Objects which you can choose from; you can then scroll down to "MSComctLib")


Did you happen to change version of MSCommon Controls in the middle of your project? Are you writing this program on more than 1 machine - say at home and at school (diff VB installations?)?? I think this was my prob when I ran into this with MDAC. Some of my projects I was NEVER   able to fix...had to redo a bunch of them ... so I would be interested in anything else you find out as well...


btw...

quote:
As i am only a novice, i hate all sorts of errors.


You don't have to be a novice to hate errors!     

____________________________
Eggheads unite! You have nothing to lose but your yolks.
03-06-2003 at 06:23 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
steve_w
Level: Moderator


Registered: 18-04-2003
Posts: 1156
icon Re: Please help me, i'm a novice

quote:

You don't have to be a novice to hate errors!  



Especially when you cannot see the problem    

03-06-2003 at 10:56 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : Please help me, i'm a novice
Previous Topic (All possible combination of number)Next Topic (how to send a simple file from a client to server by using winsock) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder