Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. displaying a particular comboBox value

displaying a particular comboBox value

Scheduled Pinned Locked Moved C#
question
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saira Tanwir
    wrote on last edited by
    #1

    hello friends, i have some values displayed in a comboBox. the selected value is stored in a variable. now the logic is this that when a button is pressed, the saved value of the combo Box is to be displayed in the combo Box. how do i accomplish this? i have tried adding the value through the 'Items' property. it adds the value into the combolist but doesn't display it directly. i've also tried the comboBox.SelectedValue property but it still doesn't work. :sigh: private void back_button_Click(object sender, System.EventArgs e) { comboBox1.SelectedValue = field_entries_array[x,3]; }//end function reply soon plz. Saira

    Y 1 Reply Last reply
    0
    • S Saira Tanwir

      hello friends, i have some values displayed in a comboBox. the selected value is stored in a variable. now the logic is this that when a button is pressed, the saved value of the combo Box is to be displayed in the combo Box. how do i accomplish this? i have tried adding the value through the 'Items' property. it adds the value into the combolist but doesn't display it directly. i've also tried the comboBox.SelectedValue property but it still doesn't work. :sigh: private void back_button_Click(object sender, System.EventArgs e) { comboBox1.SelectedValue = field_entries_array[x,3]; }//end function reply soon plz. Saira

      Y Offline
      Y Offline
      yogesh_kumar_agarwal
      wrote on last edited by
      #2

      why don't you use the text property for combobox combobox1.text="hello" Yogesh Agarwal

      S 1 Reply Last reply
      0
      • Y yogesh_kumar_agarwal

        why don't you use the text property for combobox combobox1.text="hello" Yogesh Agarwal

        S Offline
        S Offline
        Saira Tanwir
        wrote on last edited by
        #3

        ok the property worked partially. now the comboBox is displaying the value once. suppose we have three values stored in the array. a1,a2 and a3. the above mentioned property displays the value stored in a3 but after pressing the back button again, it still displays the value of a3. it should display the value of a2 and then if the button is pressed again then a1.

        Y 1 Reply Last reply
        0
        • S Saira Tanwir

          ok the property worked partially. now the comboBox is displaying the value once. suppose we have three values stored in the array. a1,a2 and a3. the above mentioned property displays the value stored in a3 but after pressing the back button again, it still displays the value of a3. it should display the value of a2 and then if the button is pressed again then a1.

          Y Offline
          Y Offline
          yogesh_kumar_agarwal
          wrote on last edited by
          #4

          For that do change in value like When you click on the back button use Combobox1.Text=a2 then a1 Yogesh Agarwal

          S 1 Reply Last reply
          0
          • Y yogesh_kumar_agarwal

            For that do change in value like When you click on the back button use Combobox1.Text=a2 then a1 Yogesh Agarwal

            S Offline
            S Offline
            Saira Tanwir
            wrote on last edited by
            #5

            my problems solved :laugh: Muajaaan e maujaan:rose:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups