| | |
Code advice For list selection
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 11
Reputation:
Solved Threads: 0
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.
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
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
Text Property is not apt for multiple selection. At that situation use the above method
Your Corrected code
ListBoxes dont have Value property. Instead
Text Property to get the selected Text
Ex
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
MsgBox LstStudent.List(LstStudent.ListIndex)
Text Property is not apt for multiple selection. At that situation use the above method
Your Corrected code
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
' Check whether anything selected If LstStudent.ListIndex >= 0 Then<blockquote> PosOfSpace = InStr ( LstStudent.List ( LstStudent.ListIndex ) , 1, " " ) txtStudentId.Text = Mid ( LstStudent.List ( LstStudent.ListIndex ) , 1, PosOfType - 1)</blockquote>else<blockquote> ' Nothing selected MsgBox "Please Select anything"</blockquote>End If
Last edited by selvaganapathy; May 1st, 2008 at 12:38 pm.
Selva ![]() |
Similar Threads
- Populate One Drop Down List From Another (ASP.NET)
- Schedule program (Python)
- Python for Birthday (but having tech difficulties) (Python)
- traceback error? (Python)
- Sorting in Python (Python)
- adding totals in listboxes (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: help with vb code to view access report
- Next Thread: Help with programming a chat program. (Urgent)
Views: 752 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





