ListBox and collection issues in C

Updated on technology 2024-03-29
24 answers
  1. Anonymous users2024-02-07

    This topic is so familiar!

    To do this problem, you need to understand the usage of listbox, which can be regarded as a skill.

    First, define an employee class, which has 4 attributes: number, name, department, and salary, and rewrite the tostring method to return the name.

    To add, listbox can be used to add object directly, and the display text automatically calls the object's tostring method. So you just need to add an employee object, populate the attributes, and add it to the listbox.

    When displaying, take out the object in the listbox, and you can directly convert it into an employee object, with the number, name, department, and salary attribute all there.

    There is not much to say about the other features, they are all regular usage.

  2. Anonymous users2024-02-06

    public partial class form2 : formpublic form2()

    initializecomponent();

    listls = new list();

    private void button1_click(object sender, eventargs e)

    emp ep = new emp();

    private void listbox1_selectedindexchanged(object sender, eventargs e)

    int index=;

    ls[index].no;

    ls[index].name;

    ls[index].job;

    ls[index].;

    class emp

    string _no;

    public string no

    get set

    string _name;

    public string name

    get set

    string _job;

    public string job

    get set

    float _salary;

    public float salary

    get set

    This is the ** note of this question, which is similar to what was said on the second floor.

  3. Anonymous users2024-02-05

    Listbox.

    Allow the numbers to be expressed in a regular expression.

    Close is ;

  4. Anonymous users2024-02-04

    You should add this to the database! If you don't add it, it will be restored every time you run it!

  5. Anonymous users2024-02-03

    ListView is similar to GridView, which is very expressive, can display icons, and has multiple columns.

    The listbox is very simple, just one column, which is a simple combobox

  6. Anonymous users2024-02-02

    Both controls can be implemented, but you should still use ListView if you need to display multiple columns of information in a list, such as file type, length, etc., in addition to the file name.

  7. Anonymous users2024-02-01

    The listbox displays a column.

    ListView displays multiple rows.

    It depends on the information your list displays.

  8. Anonymous users2024-01-31

    You can use whatever type your data is, and you can also use objects

  9. Anonymous users2024-01-30

    list<> it's generic, and it's a little vulgar, and you can put anything in it.

  10. Anonymous users2024-01-29

    Example of binding student information:

    Get the collection information of the students, here is the method, with only one student name, using your student class.

    private listgetstudentlist()return students;

    Bind student information to the control.

    /public void bindlistbox()

  11. Anonymous users2024-01-28

    1 It is easy to make mistakes when depositing in this way.

    2 Why do you use listbox if you don't want to display them one by one?

    3. How much will your myset be equal to when it comes out?

  12. Anonymous users2024-01-27

    The answer is yes. But there is a premise that variable i cannot be out of bounds.

    By traversing, you can add them one by one.

    The answer is also yes. That's how list is used.

  13. Anonymous users2024-01-26

    Suitable for placing in the changed event, which is used to give real-time results according to the listbox change, double-click the listbox control, and enter:

    private void listbox1_selectedindexchanged(object sender, eventargs e)

  14. Anonymous users2024-01-25

    Hello, the items of the listbox are imagined as a list object, c adopts the indexer mechanism, when he creates, he automatically creates an indexer property for the object of the collection, and you can access it through its index number, just like the subscript of an array array, which greatly reduces the workload of the programmer.

    Thank you!!

  15. Anonymous users2024-01-24

    Winfrom Rio's listbox does.

    But the web is not good, you can consider a different approach.

  16. Anonymous users2024-01-23

    Typically, the datasource binds a list object, and the list can be a custom type of object.

    For example: class person

    listlistps = new list();

    datasource = listps ;

    name";

    id";person selperson = (person);

    int nselectedid = (int);

    do somethings ……

  17. Anonymous users2024-01-22

    Only write your own method.

    **Reference. listarrint and listbox1for(int i=0,i<,i++) are known

  18. Anonymous users2024-01-21

    I didn't understand it too much, so be detailed.

  19. Anonymous users2024-01-20

    Generally, the former can be directly entered at runtime, and the latter cannot be directly entered at runtime.

    The former has no requirements for data structures, and the latter at least the data is in the form of a list.

  20. Anonymous users2024-01-19

    What do you mean! Is it too easy to enter a value in the textbox and display it in the listbox? Can you say more about ......

  21. Anonymous users2024-01-18

    As the name suggests, a list style, a text box style. Try it yourself on VS and you'll know!

  22. Anonymous users2024-01-17

    One is the text box.

    One is the list box.

  23. Anonymous users2024-01-16

    It's a long way off, and LZ can look at their properties and events.

  24. Anonymous users2024-01-15

    The difference between these two is too big, I don't understand how the landlord would compare these two controls,

Related questions
9 answers2024-03-29

m<=-1

The process of solving the problem is: >>>More

25 answers2024-03-29

For example, I have two lists, one is the data of the string type, and the other is the data of the integer type, and when the data is not used, you need to force the data to be converted, in case you are careless, the list of the string type is forcibly converted to the integer type, isn't it wrong? The generics will let the compiler check for you, and if you want to put string data into a generic collection of the village integer type, the compiler will report an error. This way, there will be no problem of forced conversions causing errors. >>>More

6 answers2024-03-29

Understand the following rules: 1) Overloading an operator does not change the priority of the operator. >>>More

7 answers2024-03-29

Do it by your train of thought.

Method 1. string strnumber="200m"; >>>More

8 answers2024-03-29

Let's start with the first question:

If you don't write it, you can only read a copy of the value, but you can't modify the original data. >>>More