G
Guest
I am using Visual Basic 2005.
I have created a two dimensional ArrayList named aSystem that is populated as
follows:-
aSystem.Add(New PickList(0, "Undefined"))
aSystem.Add(New PickList(-1, "Standard UTM"))
aSystem.Add(New PickList(-2, "UTM-NAD83"))
aSystem.Add(New PickList(-3, "UTM-NAD27"))
and then other items are added to the ArrayList from a sorted recordset as
follows:-
Do Until ssTemp.EOF
aSystem.Add(New PickList(ssTemp.Fields("PrimaryKey").Value, _
ssTemp.Fields("Name").Value))
ssTemp.MoveNext()
Loop
The structure of the PickList class is as follows:-
Public Structure PickList
Private mnPrimaryKey As Integer
Private msID As String
Public Sub New(ByVal PrimaryKey As Integer, ByVal ID As String)
mnPrimaryKey = PrimaryKey
msID = ID
End Sub
Public ReadOnly Property PrimaryKey() As Integer
Get
Return mnPrimaryKey
End Get
End Property
Public ReadOnly Property ID() As String
Get
Return msID
End Get
End Property
End Structure
I use the ArrayList to populate a ComboBox
With cboSystem
.DataSource = aSystem
.ValueMember = "PrimaryKey"
.DisplayMember = "ID"
End With
For the most part everything works fine; the ComboBox is populated with all
the data.
I have two problems...
1. I can't seem to read the items from the ArrayList directly. I would
expect to be
able to read the array something like this:
aSystem.Item(1)
but all I get back is:_
MagCalculator.PickList: {MagCalculator.PickList} where
where MagCalculator is the name of the application.
How do I read the individual items of the two-dimensional ArrayList?
2. I want to sort the ArrayList but although there is an abundance of
information in MSDN on how to sort a one-dimensional ArrayList, there is no
information on how to sort a two-dimensional ArrayList.
As mentioned already, I subsequently populate a ComboBox with the two
dimensional ArrayList, and this seems to work fine except of course the list
isn't sorted.
If anyone could point me in the right direction, I'd be grateful.
I have created a two dimensional ArrayList named aSystem that is populated as
follows:-
aSystem.Add(New PickList(0, "Undefined"))
aSystem.Add(New PickList(-1, "Standard UTM"))
aSystem.Add(New PickList(-2, "UTM-NAD83"))
aSystem.Add(New PickList(-3, "UTM-NAD27"))
and then other items are added to the ArrayList from a sorted recordset as
follows:-
Do Until ssTemp.EOF
aSystem.Add(New PickList(ssTemp.Fields("PrimaryKey").Value, _
ssTemp.Fields("Name").Value))
ssTemp.MoveNext()
Loop
The structure of the PickList class is as follows:-
Public Structure PickList
Private mnPrimaryKey As Integer
Private msID As String
Public Sub New(ByVal PrimaryKey As Integer, ByVal ID As String)
mnPrimaryKey = PrimaryKey
msID = ID
End Sub
Public ReadOnly Property PrimaryKey() As Integer
Get
Return mnPrimaryKey
End Get
End Property
Public ReadOnly Property ID() As String
Get
Return msID
End Get
End Property
End Structure
I use the ArrayList to populate a ComboBox
With cboSystem
.DataSource = aSystem
.ValueMember = "PrimaryKey"
.DisplayMember = "ID"
End With
For the most part everything works fine; the ComboBox is populated with all
the data.
I have two problems...
1. I can't seem to read the items from the ArrayList directly. I would
expect to be
able to read the array something like this:
aSystem.Item(1)
but all I get back is:_
MagCalculator.PickList: {MagCalculator.PickList} where
where MagCalculator is the name of the application.
How do I read the individual items of the two-dimensional ArrayList?
2. I want to sort the ArrayList but although there is an abundance of
information in MSDN on how to sort a one-dimensional ArrayList, there is no
information on how to sort a two-dimensional ArrayList.
As mentioned already, I subsequently populate a ComboBox with the two
dimensional ArrayList, and this seems to work fine except of course the list
isn't sorted.
If anyone could point me in the right direction, I'd be grateful.