473,396 Members | 1,995 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,396 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 7778
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.