Selecting items from a combo box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnnyfire
    New Member
    • Mar 2007
    • 6

    #1

    Selecting items from a combo box

    I need to be able to have a user fill in an array, called payables, of 5 different possible types, and then select from a combo box one of those payables in the array. After being selected the user hits the edit button which then pops up the box with all of the text fields already filled in. But there is 5 different types of payables. Im not sure how to go about doing this, can anyone help?
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by johnnyfire
    I need to be able to have a user fill in an array, called payables, of 5 different possible types, and then select from a combo box one of those payables in the array. After being selected the user hits the edit button which then pops up the box with all of the text fields already filled in. But there is 5 different types of payables. Im not sure how to go about doing this, can anyone help?
    You haven't said what version of VB you're using.

    But in VB6, to "select" an item in a combobox you just set the .Text property to that string. Note that this is different to the way it's done in a listbox.

    Comment

    • johnnyfire
      New Member
      • Mar 2007
      • 6

      #3
      Im using visual basic C# 2005. But Im not completely understanding how to do that. There is a max of 25 items in the array and 5 different types(invoice, hourly, salaried, commission, base+commission ) that can go in the array. Say that the user fills in an invoice. The invoice number is then put in the combo box. Say then that the user fills out a salaried employee. That puts the ssn into the combo box. Then when the user chooses either one, it is suppose to bring up the specified box with the variables filled in that the user filled out earlier. Each type has different variables that are filled in.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by johnnyfire
        Im using visual basic C# 2005.
        Let me stop you there for a moment.

        Visual Basic and C# are two different languages.

        I think we need to clarify exactly what you are working with, or any advice we give will be pure guesswork.

        However, consider this. If you have a combobox with a bunch of items in it, there are two possible ways to choose one. You will either set the "currently displayed text" property (whatever it is called in the language you're using). Or your language's equivalent of the ListIndex property, which moves the list to the specified position.

        Comment

        • johnnyfire
          New Member
          • Mar 2007
          • 6

          #5
          My fault, I meant to say Visual C# 2005

          Comment

          • johnnyfire
            New Member
            • Mar 2007
            • 6

            #6
            I have the boxes popping up properly but I dont know how to fill them with the text entered from the user.

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Originally posted by johnnyfire
              I have the boxes popping up properly but I dont know how to fill them with the text entered from the user.
              In VB6, I'd say by using the .AddItem method of the ComboBox control. In Visual C#, I have no idea.

              If you can't get the answers you need here, perhaps the people in the .Net forum would be able to help. Of possibly C++ (I don't know whether it's similar to C# or not).

              Comment

              Working...