C How to read the text of the drop down box

Updated on technology 2024-02-08
20 answers
  1. Anonymous users2024-02-05

    The drop-down box contains multiple items, and the text that can read one of the items in the drop-down box (n represents the index).

    For example, the textual relationship between the index and the drop-down box text is as follows:

    0 abc1 doc

    2 ppt then the obtained text is abc, then the obtained text is doc, and so on.

    If you want to get the currently selected item of the combobox, you can use : or:

  2. Anonymous users2024-02-04

    If you want to read and write down the drop-down text use.

    When the drop-down arrow is clicked, a dropdown event is raised.

    private void combobox1_dropdown(object sender, eventargs e)

    foreach (var item in

    Used when you want to read the data in the drop-down list.

  3. Anonymous users2024-02-03

    Just get the value attribute of that control.

  4. Anonymous users2024-02-02

    string value;Only variables are stored.

    int index = ;The index of the item that was selected.

    value = ;Get the value.

  5. Anonymous users2024-02-01

    WinForm or Webform?

    Use DropDownList or ComboBox's SelectedItem or SelectValue

  6. Anonymous users2024-01-31

    I'm referring here. .net is not winform, the principle is the same.

    dropdownlist1 is the drop-down box object.

  7. Anonymous users2024-01-30

    That's it (cmb changed to drop-down box control name).

  8. Anonymous users2024-01-29

    var parents = _;

    Fields that are displayed to the user.

    classname";

    The field that is passed to the database after selection.

    classid";

    Bind data to the drop-down box.

    parents;

    The selected text content is displayed in the label, as follows:

    private void combobox1_selectionchangecommitted(object sender, eventargs e)

  9. Anonymous users2024-01-28

    The selected text content is displayed in the label.

    Come,** as follows: Inside.

    private void combobox1_selectionchangecommitted(object sender, eventargs e)

  10. Anonymous users2024-01-27

    The text content selected by the combobox.

    Just right.

  11. Anonymous users2024-01-26

    get the data set that needs to be bound from the database copy baivar parents = ;

    Fields that are displayed for DU users.

    classname";

    Select the field that is passed to the database.

    classid";

    Bind the data to the drop-down box.

    parents;

    I read your second paragraph**.

    Didn't get a value for this line**? It doesn't feel like it should be;

  12. Anonymous users2024-01-25

    That's it. The selecttext property represents the highlighted text you selected with the mouse.

  13. Anonymous users2024-01-24

    1. First of all, we will create a new key to a winform application, and then on the interface, place a drop-down box.

    2. In the CS class, the value is bound to the drop-down box, which is used to display the effect.

    3. Go back to the form interface, select the drop-down box, and in the properties panel, select the property dropdownheight, which is the property of the height of the drop-down box.

    4. First, we set the height of the drop-down box to 200, and then, we debug the program to see the display effect.

    5. Then, we close the interface and set the value of this property to 100.

    6. After the setting is completed, let's restart it to see the effect.

    7. According to the comparison of the two times, we can find that the height set by this attribute is different, and the height displayed in the drop-down box is different.

  14. Anonymous users2024-01-23

    Get the value of the drop-down list box in c as follows:

    using system;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    public partial class form1 : formpublic form1()

    initializecomponent();

    private void button1_click(object sender, eventargs e)=;

  15. Anonymous users2024-01-22

    Landlord, yes, if you use the list box, the number of items entered exceeds the number displayed in the list box, and the scroll bar will automatically appear. If it is a combobox, find the items property in its properties window, and open it"String aggregators"Enter it and you're done, enter the wrap.

  16. Anonymous users2024-01-21

    Use the selectedIndex property of the combobox to get the number of the selected item (0 starts with -1 is unchecked).

    selectedtext attribute to get information about the selected string.

    text attribute to get the selected or user-entered string information.

    If you want to get a collection of all the list boxes. then access the item() property.

    It can be passed. add, remove, etc.

    Each element is accessed via item(i).

    If you are in the transformation stage, you can directly find the items property in its properties window and open it"String aggregators"Enter it and you're done, enter the wrap.

    Example**. using system;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    using ;

    namespace windowsformsapplication1private void button1_click(object sender, eventargs e)

    Hope it helps.

  17. Anonymous users2024-01-20

    The property of each drop-down box has an id that can be judged, and if you are binding, then it will not work, and you can only get the value of the current text box after you select it.

  18. Anonymous users2024-01-19

    int n = 0;Index.

    string str = "word";Words that need to be judged.

    if( == str)else

  19. Anonymous users2024-01-18

    Don't know what you need? Can you say that you believe in the point" I feel that you should not be a simple value.

  20. Anonymous users2024-01-17

    dllst .datasource = list; = "field"; = "field";This allows you to set the displayed and hidden values for the drop-down list box. You try it.

Related questions