|
-
Sep 17th, 2003, 11:21 PM
#1
Thread Starter
Lively Member
Error accessing record in listbox
Hi all, i got error clicking of the records found in e list box.They highlight this code got error.
' Get Primary Key from Listbox
objListItem = CType(ListBox1.SelectedItem, ListBox)
I dun noe y, i cannot select the list box item to be show in e textbox.
Please hear fr ur reply soon, cos i need this urgently, due date soon.
10q
-
Sep 17th, 2003, 11:33 PM
#2
You are casting the item to a listbox that not right. A listbox probably doesn't have listboxes for items.
objListItem = CType(ListBox1.SelectedItem, ListBox)
That should be whatever you want to cast it to.
-
Sep 18th, 2003, 01:24 AM
#3
Frenzied Member
I'm guessing that you have strings in the listbox. If thats the case then you can try this
VB Code:
Dim objListItem As String = CType(ListBox1.SelectedItem, String)
or
VB Code:
Dim lstItem as String = ListBox1.SelectedItem.ToString()
MessageBox.Show(lstItem)
-
Sep 18th, 2003, 01:49 AM
#4
Thread Starter
Lively Member
I cannot got error with that line of the code, can u pls help mi?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|