SelectedIndexChanged event in COmbobox s not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Intro
    New Member
    • Apr 2012
    • 15

    SelectedIndexChanged event in COmbobox s not working

    I have a Combobox in an Application based on Windows Forms.
    But though I change the index of items from the UI, the combobox internally doesn't fire the SelectedIndexCh anged() event.
    Does anybody has any solution ???
    I used window.open() on LinkButtonClick to open the PDF in new window.
  • RhysW
    New Member
    • Mar 2012
    • 70

    #2
    One mistake i make alot is creating the code and forgetting to hook it up to the event. In the event tab of the properties of the combobox make sure you set the event
    'SelectedIndexC hanged'
    to actually execute the code you want it to do (should either be one of the dropdown choices or might need manual pointing to the code)

    Comment

    • Intro
      New Member
      • Apr 2012
      • 15

      #3
      Hi RhysW,
      For this I have already assigned the event to the combobox and written the SelectedIndexCh anged(event e) in the code as well.

      Have I an alternative to this combobox in WindowsForms so that we can overcome this problem ?

      Comment

      • RhysW
        New Member
        • Mar 2012
        • 70

        #4
        Theres lots of alternatives, what exactly are you trying to do? use a selected combobox to open a pdf?

        personally i would be tempted to take the route of the openFileDialog and allow the user to select the file they want to open by navigating through their files, something you could limit to being only pdf's using something similar to
        Code:
        openFileDialog1.Filter = "txt files (*.txt)|*.txt";
        where the txt would be your pdf tag instead
        its what users would expect to come across when wanting to open a file and with windows forms keeping to whats expected is always good for your users :P
        i didn't go too indepth in code here because presumeably you already know how to open a pdf using file.io as that wasn't part of your question!

        Comment

        • Intro
          New Member
          • Apr 2012
          • 15

          #5
          To be clear ,
          1. I have a combobox.
          2. If I change the selected value in that, I want the index value associated with the value(selected in combobox) to be populated in another textbox.

          Comment

          • RhysW
            New Member
            • Mar 2012
            • 70

            #6
            instead of selectedindexch anged you could use the one just below it, selectedvaluech anged, reading the little explanations for each event makes it seem like the one i suggested is the event you are actually looking for

            Comment

            • Intro
              New Member
              • Apr 2012
              • 15

              #7
              Yeah...Thank you RhysW
              That worked for me..

              Comment

              • adriancs
                New Member
                • Apr 2011
                • 122

                #8
                Intro, you have to mark RhysW's answer as selected answer.

                Comment

                Working...