Jump to content

Combobox Hell

- - - - -

  • Please log in to reply
4 replies to this topic

#1
jkjavedpro

jkjavedpro

    Newbie

  • Members
  • Pip
  • 2 posts
Hi All,


I have ap problem related to database and combobox..

i have a combo box which retrives the number of UserID from Database as

1
2
3
4
5
6
7
8

Now what i need to do is , if i select 3 from Combobox, then Userid1 ,Userid2, UserID3,
Should get selected and if 2 then Userid1 and userId2 Sholuld get selected from database...

Its very urgent...plz...help :(

Thanks in advance

#2
zoranh

zoranh

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 207 posts
Add integers to combo box using Items.Add() method. Avoid adding strings, but rather add integers because you'll operate with integers later.

Handle the SelectedIndexChanged event of combo box if you wish to do some work immediately after combo box selection changes. Use SelectedItem property to retireve the integer which is selected.

Use DropDownStyle property to forbid/allow user to type values in combo box.

Use DataSource and DisplayMember properties to load contents of the combo box from a collection (e.g. array of objects retrieved from database).

#3
jkjavedpro

jkjavedpro

    Newbie

  • Members
  • Pip
  • 2 posts
hi,

i have binded the combobox with numbers from 1 to 8 as number of data in database and also have a collection of data from database.


now if i select 3 from combobox it should display 3 userid as userid1,userid2,userid3.... how to do dis..i m not getiing it.

#4
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
I am not getting what you want to get from that code ? :(

#5
Momerath

Momerath

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 242 posts

jkjavedpro said:

hi,

i have binded the combobox with numbers from 1 to 8 as number of data in database and also have a collection of data from database.
now if i select 3 from combobox it should display 3 userid as userid1,userid2,userid3.... how to do dis..i m not getiing it.

Do you have the code where you are attempting to get the values from the database? Can you post it?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users