Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: VB equivalent of Itemdata in Combo box

2 views
Skip to first unread message

Brad Shook

unread,
Oct 15, 2004, 12:29:39 PM10/15/04
to
Yes,
after setting the datasource set the displaymember to the field you want to
see and the valuemember the the id.
Brad
"Sivaprasad" <sshan...@hotmail.com> wrote in message
news:OyGL7Mts...@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
>
>


Sivaprasad

unread,
Oct 15, 2004, 1:18:38 PM10/15/04
to
I am not setting a datasource. I am adding the data to the combo with the
code.
Siva

"Brad Shook" <bsh...@echd.org.removeme> wrote in message
news:ObM8rQts...@TK2MSFTNGP10.phx.gbl...

Josip Medved

unread,
Oct 15, 2004, 5:57:47 PM10/15/04
to
> 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

Mike McIntyre

unread,
Oct 15, 2004, 12:29:44 PM10/15/04
to
Good article at: http://www.mgbrown.com/PermaLink.aspx?ItemID=37


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"Sivaprasad" <sshan...@hotmail.com> wrote in message
news:OyGL7Mts...@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?
>

Sivaprasad

unread,
Oct 15, 2004, 2:14:15 PM10/15/04
to
'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" <mik...@dotnetshowandtell.com> wrote in message
news:uE%23m4Qts...@TK2MSFTNGP12.phx.gbl...

0 new messages