|
-
Feb 7th, 2004, 09:24 PM
#1
Thread Starter
New Member
-
Feb 7th, 2004, 11:15 PM
#2
Frenzied Member
An Arraylist is a collection object. You can add and delete from the collection dynamically. If you ever used VB 6, you would have to use an array and then redim if you wanted the size to grow.
With the ArrayList its all dynamic. So I dont think thats what you are looking for. All the ArrayList does is stores you collection of objects.
-
Feb 8th, 2004, 12:40 AM
#3
Thread Starter
New Member
I would like to learn these things I just can't seem find a good example on the web. If you can think of one thank you .
-
Feb 8th, 2004, 03:18 AM
#4
If you plan on using DataBinding then I'd advise switching that structure to a class and use properties instead of fields because databinding doesn't like fields.
-
Feb 8th, 2004, 06:26 PM
#5
Thread Starter
New Member
-
Feb 8th, 2004, 06:31 PM
#6
Thread Starter
New Member
Originally posted by RBCC
[SIZE=3]Structure trans[Structure trans
Dim number As Integer
Dim type As String
Dim amount As Single
End Structure
Dim transaction As trans
Dim fv As StreamReader = File.OpenText("trans.txt")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim transarray As New ArrayList
Dim trans_array As New ArrayList
Dim icounter As Int16
transarray = get_transactions(trans_array)
output_transactions(transarray)
End Sub
Function get_transactions(ByRef array As ArrayList) As ArrayList
Dim trans_counter As Integer
Dim trans_read() As String
Do
trans_read = fv.ReadLine.Split(","c)
transaction.amount = trans_read(0)
transaction.type = Convert.ToString(trans_read(1))
transaction.number = trans_read(2)
array.Add(transaction)
trans_counter = +1
Loop Until fv.Peek = -1
Return array
End Function
Private Sub output_transactions(ByVal array As ArrayList)
Dim transactions As trans
Dim trans_counter As Integer
For Each transactions In array
lstaccounts.Items.Add(transactions.number)
Next
End Sub
Private Sub lstaccounts_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstaccounts.SelectedIndexChanged
Dim trans_array As ArrayList
txt_type.Text = transaction.type
txt_amount.Text = transaction.amount
End Sub/SIZE]
I am trying to get the transaction type and amount to be outputted to the textboxes when the user click on an account number in the list box . Where did I go wrong
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
|