By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,806 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,806 IT Pros & Developers. It's quick & easy.

Fill Combo with Text and Value how?

P: n/a
I want to fill a combo box with a Text value to show like name, but when it
is selected I want to get the say SS# or Emp #.

I will be filling this in manually how should I go about this.

I know

combo1.items.add(Item)

But what I don't get is how to assign both the text and value at the same
time.

Thanks,

Rog
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
try:
combo1.items.add(new listitem("text","value"))

"Roger" <da*****@netins.net> wrote in message
news:eG**************@TK2MSFTNGP14.phx.gbl...
I want to fill a combo box with a Text value to show like name, but when it is selected I want to get the say SS# or Emp #.

I will be filling this in manually how should I go about this.

I know

combo1.items.add(Item)

But what I don't get is how to assign both the text and value at the same
time.

Thanks,

Rog

Nov 21 '05 #2

P: n/a
ListItem is not a valid object for me. What do I need to use to clarify it.
Is it a
ListviewItem?

Thanks,

Roger
"Richard Dudley" <rj******@gmail.com> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
try:
combo1.items.add(new listitem("text","value"))

"Roger" <da*****@netins.net> wrote in message
news:eG**************@TK2MSFTNGP14.phx.gbl...
I want to fill a combo box with a Text value to show like name, but when

it
is selected I want to get the say SS# or Emp #.

I will be filling this in manually how should I go about this.

I know

combo1.items.add(Item)

But what I don't get is how to assign both the text and value at the same time.

Thanks,

Rog


Nov 21 '05 #3

P: n/a
"Roger" <da*****@netins.net> schrieb:
I want to fill a combo box with a Text value to show like name, but when it
is selected I want to get the say SS# or Emp #.

I will be filling this in manually how should I go about this.

I know

combo1.items.add(Item)

But what I don't get is how to assign both the text and value at the same
time.


\\\
Me.ComboBox1.Items.Add(New Person("Pink Panther", 22)

' Test.
MsgBox(DirectCast(Me.ComboBox1*.Items(0), Person).ToString())
..
..
..
Public Class Person
Private m_Name As String
Private m_Age As Integer

Public Sub New(ByVal Name As String, ByVal Age As Integer)
Me.Name = Name
Me.Age = Age
End Sub

Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal Value As String)
m_Name = Value
End Set
End Property

Public Property Age() As Integer
Get
Return m_Age
End Get
Set(ByVal Value As Integer)
m_Age = Value
End Set
End Property

Public Overrides Function ToString() As String
Return Me.Name & " (" & Me.Age.ToString() & ")"
End Function
End Class
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.