vincentnl
Active member
I create a datarow array and want to add two fields of that array to my listbox. One column of courseNames (displaymember) and one courseID (valuemember)
Dim draCourses As DataRow()
draCourses = drSelectedClub.GetChildRows("ClubsCourses")
lstCourses.datasource = draCourses
lstCourses.DisplayMember = "CourseName"
lstCourses.ValueMember = "CourseID"
But now entire rows are returned when i ask for the valuemember of a list selection !
The other method i thought of was addint the items one by one, but it does not seem possible to add a value to an item (it will display one, and return the other)
Load listbox for courses
Dim drCourse As DataRow
For Each drCourse In draCourses
lstCourses.Items.Add(drCourse.Item("CourseName"))
Next
Can anybody help me out?
Dim draCourses As DataRow()
draCourses = drSelectedClub.GetChildRows("ClubsCourses")
lstCourses.datasource = draCourses
lstCourses.DisplayMember = "CourseName"
lstCourses.ValueMember = "CourseID"
But now entire rows are returned when i ask for the valuemember of a list selection !
The other method i thought of was addint the items one by one, but it does not seem possible to add a value to an item (it will display one, and return the other)
Load listbox for courses
Dim drCourse As DataRow
For Each drCourse In draCourses
lstCourses.Items.Add(drCourse.Item("CourseName"))
Next
Can anybody help me out?