PC Review


Reply
Thread Tools Rate Thread

combobox Display member

 
 
Paul Ilacqua
Guest
Posts: n/a
 
      24th Mar 2010
Data Entry App Using VB 2005

I'm filling a combobox (code below) with a List(Of CWO) , a class I
defined.. No problem. Lookups return a CWO type, again no problem.

I have a "Load Last Record" function that will populate the form along with
that combobox with values from the database. The value coming in is the
"ValueMember", not the "DisplayMember". How can I load the "ValueMember" but
have the combobox display the DisplayMember?


Dim CWOList As New List(Of CWO)

Dim MyCWO As CWO
SqlDr = ESData.GetReader(sSQL, False)

Do While SqlDr.Read
MyCWO = New CWO
MyCWO.CWONumber = SqlDr(0).ToString
MyCWO.CWOText = SqlDr(1).ToString
CWOList.Add(MyCWO)
Loop
SqlDr.Close()
With ComboBox1
.DataSource = CWOList
.ValueMember = "CWONumber"
.DisplayMember = "CWONumAndText"
End With

set a combobox value that has been filled with list of

 
Reply With Quote
 
 
 
 
Jeff Johnson
Guest
Posts: n/a
 
      25th Mar 2010
"Paul Ilacqua" <(E-Mail Removed)> wrote in message
news:E363603F-3FDF-4994-B587-(E-Mail Removed)...

> Data Entry App Using VB 2005
>
> I'm filling a combobox (code below) with a List(Of CWO) , a class I
> defined.. No problem. Lookups return a CWO type, again no problem.
>
> I have a "Load Last Record" function that will populate the form along
> with that combobox with values from the database. The value coming in is
> the "ValueMember", not the "DisplayMember". How can I load the
> "ValueMember" but have the combobox display the DisplayMember?


ComboBox1.SelectedValue = yourValueMemberVariable


 
Reply With Quote
 
Paul Ilacqua
Guest
Posts: n/a
 
      25th Mar 2010
Jeff,
Thanks so much... I totally missed that property, I was looking at text,
SelectedItem etc.
Paul

"Jeff Johnson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Paul Ilacqua" <(E-Mail Removed)> wrote in message
> news:E363603F-3FDF-4994-B587-(E-Mail Removed)...
>
>> Data Entry App Using VB 2005
>>
>> I'm filling a combobox (code below) with a List(Of CWO) , a class I
>> defined.. No problem. Lookups return a CWO type, again no problem.
>>
>> I have a "Load Last Record" function that will populate the form along
>> with that combobox with values from the database. The value coming in is
>> the "ValueMember", not the "DisplayMember". How can I load the
>> "ValueMember" but have the combobox display the DisplayMember?

>
> ComboBox1.SelectedValue = yourValueMemberVariable
>


 
Reply With Quote
 
Paul Ilacqua
Guest
Posts: n/a
 
      25th Mar 2010
One other issue... after I load the last record, and post it, I clear the
screen, after the combobox's text propert is set to "", I can no longer
populate the load last record.

"Paul Ilacqua" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Jeff,
> Thanks so much... I totally missed that property, I was looking at text,
> SelectedItem etc.
> Paul
>
> "Jeff Johnson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> "Paul Ilacqua" <(E-Mail Removed)> wrote in message
>> news:E363603F-3FDF-4994-B587-(E-Mail Removed)...
>>
>>> Data Entry App Using VB 2005
>>>
>>> I'm filling a combobox (code below) with a List(Of CWO) , a class I
>>> defined.. No problem. Lookups return a CWO type, again no problem.
>>>
>>> I have a "Load Last Record" function that will populate the form along
>>> with that combobox with values from the database. The value coming in is
>>> the "ValueMember", not the "DisplayMember". How can I load the
>>> "ValueMember" but have the combobox display the DisplayMember?

>>
>> ComboBox1.SelectedValue = yourValueMemberVariable
>>

>


 
Reply With Quote
 
Jeff Johnson
Guest
Posts: n/a
 
      26th Mar 2010
"Paul Ilacqua" <(E-Mail Removed)> wrote in message
news:61722EC8-0717-4223-8F2B-(E-Mail Removed)...

> One other issue... after I load the last record, and post it, I clear the
> screen, after the combobox's text propert is set to "", I can no longer
> populate the load last record.


I have no idea what you're trying to say. "Populate the load last record"
makes no sense to me.

And to clear a combo box, you shouldn't set its text to "" but rather set
its SelectedIndex to -1.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Display Member and Value Member [roperties of combobox Murtaza Microsoft ADO .NET 0 13th Dec 2007 05:46 AM
Combobox display and value member Nofi Microsoft C# .NET 3 22nd Aug 2006 04:59 PM
Format Combobox Display Member AMDRIT Microsoft VB .NET 2 28th Sep 2005 04:18 PM
Combobox / Display Member / SQL Question =?Utf-8?B?U3Rld2FydCBMYW5l?= Microsoft VB .NET 1 9th Aug 2005 05:11 AM
Binding two values to combobox display member property Hanumanth Reddy Microsoft C# .NET 2 30th Mar 2005 08:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:42 AM.