-
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.
-
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.
-
Listbox.
Allow the numbers to be expressed in a regular expression.
Close is ;
-
You should add this to the database! If you don't add it, it will be restored every time you run it!
-
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
-
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.
-
The listbox displays a column.
ListView displays multiple rows.
It depends on the information your list displays.
-
You can use whatever type your data is, and you can also use objects
-
list<> it's generic, and it's a little vulgar, and you can put anything in it.
-
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()
-
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?
-
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.
-
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)
-
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!!
-
Winfrom Rio's listbox does.
But the web is not good, you can consider a different approach.
-
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 ……
-
Only write your own method.
**Reference. listarrint and listbox1for(int i=0,i<,i++) are known
-
I didn't understand it too much, so be detailed.
-
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.
-
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 ......
-
As the name suggests, a list style, a text box style. Try it yourself on VS and you'll know!
-
One is the text box.
One is the list box.
-
It's a long way off, and LZ can look at their properties and events.
-
The difference between these two is too big, I don't understand how the landlord would compare these two controls,
m<=-1
The process of solving the problem is: >>>More
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
Understand the following rules: 1) Overloading an operator does not change the priority of the operator. >>>More
Do it by your train of thought.
Method 1. string strnumber="200m"; >>>More
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