Ben, just doing a bit of testing, if I set a ListBoxes' ValueMember to a
String (or any value for that matter) it throws an error.
But, if I comment out : Listbox1.ValueMember ="EST00123" then the rest of my
code sample I posted previously works.
I think there is a misunderstanding of what ValueMember is/or does(on my
part). The example in Help for Listbox, gives a sample of populating a
Listbox from an Array and uses ValueMember. But, I cannot get the sample to
work properly.
Of course, it could be that I am misunderstanding how the code sample is
supposed to be used.
But, try commenting out the Listbox1.ValueMember and see if your code works
then.
james
[quoted text, click to view] "Ben" <Ben@Newsgroups.microsoft.com> wrote in message
news:OPnfxnOVGHA.4952@TK2MSFTNGP09.phx.gbl...
> Hi James
>
> Thanks for your post.
>
> It is very odd as this is exactly what I am doing.
>
> Is the problem that the value data (ListBox1.ValueMember) cannot contain
> text? As the data in here is eg 'EST00123'
>
> Thanks
> B
>
> "james" <jjames700REMOVEME@earthlink.net> wrote in message
> news:e6kSNVOVGHA.4976@TK2MSFTNGP11.phx.gbl...
>> Ben, here's a quick example of what I'm talking about with a form
> containing
>> a textbox and a listbox:
>>
>>
>> Private Sub Form1_Load(ByVal sender As Object, ByVal e As
> System.EventArgs)
>> Handles Me.Load
>>
>> For i As Integer = 1 To 10
>>
>> ListBox1.Items.Add(i).ToString()
>>
>> Next
>>
>> End Sub
>>
>> Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e
> As
>> System.EventArgs) Handles ListBox1.SelectedIndexChanged
>>
>> TextBox1.Text = ListBox1.SelectedItem.ToString
>>
>> End Sub
>>
>>
>> Now, when you click on any value in the listbox, the value is shown in
>> the
>> textbox and the value changes as you select each one(replacing the
> previous
>> value).
>> james
>>
>> (sorry if this is something you already knew)
>>
>>
>>
>>
>>
>>
>
>