473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

VB equivalent of Itemdata in Combo box

Hi,

I have a combo box which displays FirstName+ Last Name of a person.
I want to store their id's in the combo like we store in ItemData of VB 6
combo box.
Is there any itemdata equivalent in VB.Net Combo?

Another problem is,
I am trying to do this using a class and add this class in the combo.
But SelectedIndexChanged event of combo box is returning the same last item
every time i change the selection.
Please help me on both.

Thanks
Siva
Nov 21 '05 #1
5 7772
Good article at: http://www.mgbrown.com/PermaLink.aspx?ItemID=37
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Sivaprasad" <ss********@hotmail.com> wrote in message
news:Oy**************@tk2msftngp13.phx.gbl...
Hi,

I have a combo box which displays FirstName+ Last Name of a person.
I want to store their id's in the combo like we store in ItemData of VB 6
combo box.
Is there any itemdata equivalent in VB.Net Combo?

Another problem is,
I am trying to do this using a class and add this class in the combo.
But SelectedIndexChanged event of combo box is returning the same last
item every time i change the selection.
Please help me on both.

Thanks
Siva

Nov 21 '05 #2
Yes,
after setting the datasource set the displaymember to the field you want to
see and the valuemember the the id.
Brad
"Sivaprasad" <ss********@hotmail.com> wrote in message
news:Oy**************@tk2msftngp13.phx.gbl...
Hi,

I have a combo box which displays FirstName+ Last Name of a person.
I want to store their id's in the combo like we store in ItemData of VB 6
combo box.
Is there any itemdata equivalent in VB.Net Combo?

Another problem is,
I am trying to do this using a class and add this class in the combo.
But SelectedIndexChanged event of combo box is returning the same last item every time i change the selection.
Please help me on both.

Thanks
Siva

Nov 21 '05 #3
I am not setting a datasource. I am adding the data to the combo with the
code.
Siva

"Brad Shook" <bs****@echd.org.removeme> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
Yes,
after setting the datasource set the displaymember to the field you want
to
see and the valuemember the the id.
Brad
"Sivaprasad" <ss********@hotmail.com> wrote in message
news:Oy**************@tk2msftngp13.phx.gbl...
Hi,

I have a combo box which displays FirstName+ Last Name of a person.
I want to store their id's in the combo like we store in ItemData of VB 6
combo box.
Is there any itemdata equivalent in VB.Net Combo?

Another problem is,
I am trying to do this using a class and add this class in the combo.
But SelectedIndexChanged event of combo box is returning the same last

item
every time i change the selection.
Please help me on both.

Thanks
Siva


Nov 21 '05 #4
'This is the code i have, to load the combo

****************************************

SQL = "Select distinct office from tblrace"

objRetrieve = objDatabase.RetrieveDataAccess(SQL)

While objRetrieve.Read

'My class has to items.One is office and the other is "Candidate name" both
are strings.In here I am adding only office

objclsCombo.Office = objRetrieve.Item("Office")

cboRace.Items.Add(objclsCombo)

End While

*****************************************

I put this code in this event, its always giving the last item in the combo.

but the combo shows the selected item.

Private Sub cboRace_SelectedValueChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cboRace.SelectedValueChanged

MessageBox.Show(CType(cboRace.SelectedItem, clsComboRace).Office.ToString)

end sub

************************************************** ************

Siva

"Mike McIntyre" <mi****@dotnetshowandtell.com> wrote in message
news:uE****************@TK2MSFTNGP12.phx.gbl...
Good article at: http://www.mgbrown.com/PermaLink.aspx?ItemID=37
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Sivaprasad" <ss********@hotmail.com> wrote in message
news:Oy**************@tk2msftngp13.phx.gbl...
Hi,

I have a combo box which displays FirstName+ Last Name of a person.
I want to store their id's in the combo like we store in ItemData of VB 6
combo box.
Is there any itemdata equivalent in VB.Net Combo?

Another problem is,
I am trying to do this using a class and add this class in the combo.
But SelectedIndexChanged event of combo box is returning the same last
item every time i change the selection.
Please help me on both.

Thanks
Siva


Nov 21 '05 #5
> Is there any itemdata equivalent in VB.Net Combo?

Not as such but I made simple replacement for it.
Try at http://www.jmedved.com?findbyname=tagitem.

--
Pozdrav,
Josip Medved, MCSD
http://www.jmedved.com
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tark Siala | last post by:
hi in VB6 (Listbox and Combobox) have nice Properties called (Item Data) when i go to VB.NET i can't Find this Properties :( please help me , i want Save tow value in one item in ComboBox 1 -...
5
by: Sivaprasad | last post by:
Hi All, Can anybody tell me what is the "itemdata" in Combo box of VB6 equivalent in ..VB.Net. Like we do in VB 6, I want to retrieve the id of the selected item from a combo box. I tried...
2
by: Prabhudhas Peter | last post by:
I need a ComboBox property like "ItemData" in VB.Net as in VB 6.0. The Idea behind this question is, i've created a user control combo box in vb.net with my own set of properties..now i want to...
1
by: suleman270 | last post by:
I want to populate the combo box in this way that to place the Client ID in the Itemdata and the name in the text. Like what can i do in VB6 combo1.additem rsLocal!ClientName combo1.Itemdata(new...
4
by: John Brown | last post by:
I am just starting with VB 2005 . VB6 list boxes and combo boxes had ItemData property. I utilized that feature a lot because all I want to create a transaction or entry in a DataBase is the item...
7
by: Tark Siala | last post by:
when i working on VB6 with ComboBox i use ItemData to save Id Number with Visible Name, and use it to get Data from Database. but now i working in VB.NET and se ComboBox, i can Fill Visible Name by...
1
by: swapna.munukoti | last post by:
Hi all, Is there a way to display some text in html select control by default which when the control is clicked, will not be listed in the drop down that contains its options. For example:...
14
by: Just_a_fan | last post by:
In VB6, I could easily take the value from a combo box and make a command with it, this: baudrate = cboBaud(listindex). With the new dotted stuff in VB9, I can't seem to do that. Here's an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.