|
-
May 25th, 2004, 08:56 AM
#1
Thread Starter
Hyperactive Member
What data type to use?
Hey,
I want to creat such items collection (like table):
On item consist such data:
Name (String), Type (String), Validation (String), Order (Integer), Emails (Elements list, array os smth)
What data types to uses, how to write such collection?
Thanx
-
May 25th, 2004, 08:56 AM
#2
Use a structure or a class.
-
May 25th, 2004, 09:05 AM
#3
Thread Starter
Hyperactive Member
Can you give me an example?
What data type to use when storing strings list?
-
May 25th, 2004, 09:24 AM
#4
Thread Starter
Hyperactive Member
I tried to use structure, but it is not what I need.
I need something like table:
Every item must consist Name (String), Type (String), Validation (String), Order (Integer). What data type to use and how to use it?
Emails I can store seperatly in arraylist.
-
May 25th, 2004, 09:30 AM
#5
Hyperactive Member
I'm sorry, but could you explain why a structure is not suitable for your needs?
If you create a structure, and then create items of that structure type, you can add the new items to an arraylist.
Perhaps I am just not understanding what you need, but based on your explanation and my experience, a structure should work perfectly.
-
May 25th, 2004, 09:36 AM
#6
Thread Starter
Hyperactive Member
Can you give me an exampe?
There would be more then one item (row) in this array:
I need something like this to use:
dim myList as MuCustomArrayList
myList.Add(Name1, Type1, Validation1, Order1)
myList.Add(Name2, Type2, Validation2, Order2)
myList.Add(Name3, Type3, Validation3, Order3)
To read 1rs item's order:
Response.write Ctype(myList(1).Items(4).Value, Integer)
-
May 25th, 2004, 09:57 AM
#7
Hyperactive Member
Ok, try this:
VB Code:
' Declarations Section
Public Structure myListItem
Public Name As String
Public Type As String
Public Validation As String
Public Order As Int32
End Structure
Private myItemsList As ArrayList = New ArrayList
' New Sub to add and get the Items, you probably want to use separate subroutines for this.
Private Sub GetMyItemOrder()
Dim myItem As myListItem
Dim Items As Int32
For Items = 0 To 4
myItem.Name = "User" + Items.ToString
myItem.Type = "Type" + Items.ToString
myItem.Validation = ">0"
myItem.Order = Items
myItemsList.Add(myItem)
Next
myItem = myItemsList(1)
Me.TextBox1.Text = myItem.Order.ToString
End Sub
Hope this helps you.
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
|