Re: Listbox on windows form
is it a listbox or listview? cause you called it both
also put on option strict and your error may become more apparent
Re: Listbox on windows form
Its a listbox.
Where do I call it a listview ?
Re: Listbox on windows form
Quote:
Originally Posted by venerable bede
Its a listbox.
Where do I call it a listview ?
the first line of ur post
I use the following code to bind a list of tables from my database to a listview control on a windows form
Re: Listbox on windows form
anyway, I am not a big fan of data binding, but try something like this, since listboxes hold objects and not strings like VB6
lblTable.Text = lstTables.SelectedItem.ToString
Re: Listbox on windows form
:blush: Apologies :blush:
Re: Listbox on windows form
Re: Listbox on windows form
Nope
GGGGrrrrrrrrrrrrrrrrrrrr
Re: Listbox on windows form
ok so the listbox populates correctly though??? its just the line of code with the label you are having trouble with?
Re: Listbox on windows form
It populates the Listbox with all my tables but when I click on an entry I get :
Code:
An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll
Additional information: Cast from type 'DataRowView' to type 'String' is not valid.
This is childsplay. I am ashamed of myself. :mad:
Re: Listbox on windows form
ok here it is
Code:
lblTable.Text = lstTables.GetItemText(lstTables.SelectedItem)
Re: Listbox on windows form
I love U Kleinma.
May Santa shower you with gifts.
A new high spec PC, IPAQ, He man action figures and Skull mountain and a Jag....with some naked nuns and a midget thrown in.
You can have Bodwad for a few hours gratification as well.
:)
I still feel a right pensi though.
Re: Listbox on windows form
I want castle grayskull please, mine was demolished as a child in a freak accident when somehow it fell (was thrown) off my roof