PosOfSpace = InString(LstStudent.Value, 1, " ")

txtStudentId.Text = Mid(LstStudent.Value, 1, PosOfType - 1)


I'm tring to get the studentId to show up in the StudentId text box. This is supposed to be done by double clicking on the student you want process This is in the list called LstStudent.

This code is in a double clilck event on a list box.

the bolded part of code is where i'm encoutnering my error

its a comple erroe saying method or datamember not found.

Hi
ListBoxes dont have Value property. Instead
Text Property to get the selected Text
Ex

MsgBox LstStudent.Text

ListIndex property is used to get the current selected Item Index. If none of the item is selected it has -1 value

List() Property contains all the Items like array
U can use similar to the above using ListIndex

MsgBox LstStudent.List(LstStudent.ListIndex)

Text Property is not apt for multiple selection. At that situation use the above method
Your Corrected code

' Check whether anything selected
If LstStudent.ListIndex >= 0 Then
[INDENT]
PosOfSpace = InStr ( LstStudent.List ( LstStudent.ListIndex ) , 1, " " )
txtStudentId.Text = Mid ( LstStudent.List ( LstStudent.ListIndex ) , 1, PosOfType - 1)[/INDENT]
else
[INDENT]  
' Nothing selected
MsgBox "Please Select anything"[/INDENT]
End If
This question has already been answered. Start a new discussion instead.