Home > other >  C # form design problem sets will not do
C # form design problem sets will not do

Time:11-07

Field on your form to create a list box, a text box and a button, the column in the list box with the names of the twelve students choose one student's name, click on this button, then in the text box shows the student's class,

CodePudding user response:

The following is my on baidu to find the answer, can't read
Student stu1 []=new student [3]. The definition of the student class can directly write? Don't need any matting??
And the name and the class don't need to define? Look not to understand, novice self-study problems well
Private void button1_Click (object sender, EventArgs e)
{
Enclosing textBox1. Text=stu1 [this. ListBox1. SelectedIndex]. Classes;
}
Student stu1 []=new student [3].
Private void Form1_Load (object sender, EventArgs e)
{
Stu1 [0]=new student (" s0 ", "c00");
Stu1 [1]=new student (" s1 ", "c01");
Stu1 [2]=new student (" s2 ", "our fleet");
For (int I=0; I & lt; Stu1. Length; I++)
This. The listBox1. Items. The Add (stu1 [I] name);
}
}
Define the class alone, in the three students, for example

CodePudding user response:

The following is my on baidu to find the answer, can't read
Student stu1 []=new student [3]. The definition of the student class can directly write? Don't need any matting??
And the name and the class don't need to define? Look not to understand, novice self-study problems well
Private void button1_Click (object sender, EventArgs e)
{
Enclosing textBox1. Text=stu1 [this. ListBox1. SelectedIndex]. Classes;
}
Student stu1 []=new student [3].
Private void Form1_Load (object sender, EventArgs e)
{
Stu1 [0]=new student (" s0 ", "c00");
Stu1 [1]=new student (" s1 ", "c01");
Stu1 [2]=new student (" s2 ", "our fleet");
For (int I=0; I & lt; Stu1. Length; I++)
This. The listBox1. Items. The Add (stu1 [I] name);
}
}
Define the class alone, in the three students, for example
  • Related