BigOrangeMonkey
Programmer
Hi There,
I'm populating a list using an array of type MyStructure but I cant get it to display the description in the list, also when I set the valuemember it gives the error :
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Could not bind to the new display member.
Heres some code :
Any Ideas?
Thanks,
Steve.
I'm populating a list using an array of type MyStructure but I cant get it to display the description in the list, also when I set the valuemember it gives the error :
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Could not bind to the new display member.
Heres some code :
Code:
Private Structure ListContainerStruct
Dim ProductId As String
Dim AreaId As String
Dim GroupId As String
Dim WorkgroupId As String
Dim SequenceNo As String
Dim Description As String
End Structure
Private Sub BuildMainList()
Dim TempWebAreaDefRow As WEBAREADEFINITIONS.webAreaDefinitionsRow
Dim i As Integer = 0
Dim MyArray() As ListContainerStruct
For Each TempWebAreaDefRow In m_WebAreaDefsDS.Tables(0).Rows
ReDim Preserve MyArray(i)
With MyArray(i)
.AreaId = TempWebAreaDefRow.area_id
.ProductId = TempWebAreaDefRow.product_id
.Description = TempWebAreaDefRow.description
End With
i = i + 1
Next
WebAreaDefsLst.DataSource = MyArray
WebAreaDefsLst.DisplayMember = "Description"
WebAreaDefsLst.ValueMember = "AreaId"
WebAreaDefsLst.SelectedIndex = 0
End Sub
Any Ideas?
Thanks,
Steve.