dcsimg
Results 1 to 5 of 5
  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    95

    combox selectedindsex or selecteditem

    Hi

    When to use selextedindex
    When to use selecteditem

    Whit a example please

  2. #2
    Hyperactive Member
    Join Date
    Sep 2017
    Posts
    418

    Re: combox selectedindsex or selecteditem

    When to use selextedindex
    This is used for when you are slaying dragons.

    When to use selecteditem
    And after slaying said dragon you use this to collect the princess

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2007
    Posts
    95

    Re: combox selectedindsex or selecteditem

    dont understand it

  4. #4
    Hyperactive Member
    Join Date
    Sep 2017
    Posts
    418

    Re: combox selectedindsex or selecteditem

    Imagine yourself in a dimly lit corridor, making your way toward a faint cry for help. As you approach "RAWR" is this scary fire breathing dragon! OMG now is a perfect time to get your arcanite reaper, which hopefully is SelectedIndex(0) bcz you dont have a lot of time here. To make a long story short, after a long and cumbersome exhaustive battle you have slain your enemy and smote his ruins in the fiery hell from which he haled. Now is where you can utilize your SelectedItem to rescue the princes and live happily ever after...

  5. #5
    Hyperactive Member
    Join Date
    Nov 2017
    Posts
    322

    Re: combox selectedindsex or selecteditem

    Let's say you have a ComboBox that contains a list of names:

    Aaron
    Ben
    Chris
    David
    Edgar
    Frank
    ...

    SelectedItem would give you the name that was selected, so if you select David it gives you David, if you select Aaron, it gives you Aaron.

    SelectedIndex would give you the numeric position in the list (starting at 0) that is selected, so if you click Aaron it gives you 0, if you click Ben it gives you 1, if you click Chris it gives you 2, and so on. This would be useful if you have a parallel array that contains other information about the people in the list. You would use SelectedIndex to retrieve that other information from the parallel array.

    Example: You have an array called DateOfBirth() that contains the Dates that each person in the list was born in (in the same order that they appear in the ComboBox), and you have a text box that you want to display the birthday of the person selected from your ComboBox.

    You would do something like this:

    Code:
    txtBirthDate.Text = DateOfBirth(cboComboBoxName.SelectedIndex).ToShortDateString

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width