|
-
May 11th, 2005, 07:10 PM
#1
Thread Starter
Junior Member
defining properties
sup
i have a register application with many different products that i'd like to assign different properties to. i already have things like
VB Code:
'Product stuff
Public Const pro As String = "PRODUCT"
Public Const pro_sm As Integer = 3.79
Public Const pro_lg As Integer = 5.99
but i would like to have them contain properties like
and define exactly what Combo means, in the same way the application knows what Integer or String means.
in other words, i want to create my own object (i think)
as you can see, i'm very confused as to what i need to do, but any help, or link to other thread/help is greatly appreciated.
thanks
stephen
-
May 11th, 2005, 07:45 PM
#2
Re: defining properties
If you create something like this:
VB Code:
public class SomeClass
'Stuff in here
end class
Then you can use it just like the other items:
However, you have to have that New in there somewhere.
Thus, what you are looking for are classes (or structures, which are similar). However, there are many steps along that path, and this is the smallest of them. Classes are easy to use, and they are easy to use poorly, but that's where learning comes from. Object oriented design is a large and difficult subject, but you don't need to know it all to use a part of it.
My usual boring signature: Nothing
 
-
May 11th, 2005, 07:48 PM
#3
Re: defining properties
Create a class called Combo, define a few Public Properties in it. Then, in the 'parent' (current) class, declare a Public Property of type Combo.
Quick example, without syntax checking.
VB Code:
Public Class MainClass
Public Property XYZ() As String
'Get
'Set
End Property
Public Property MyCombo() As Combo
'GEt
'Set
End Property
End Class
Public Class Combo
Public Property Name() As String
'Get
'Set
ENd Property
Public Property Value() As String
'Get
'Set
End Property
End Class
-
May 11th, 2005, 08:04 PM
#4
Re: defining properties
There's the next step.
By the way, have you been working with classes at all before? I guessed that you had not, but if I was wrong, my post was pretty elementary. If I guessed right....well, it is the way to start out. Everything else is easier.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|