Step 2: Initialize the Form
To initialize the form, double-click the form and add the following code to the Form_Load event:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'put some text in the large text window
TextBox4.Text = TextBox1.Text & vbCrLf & TextBox2.Text & vbCrLf & TextBox3.Text
'select first item in the listbox
ListBox1.SetSelected(0, True)
TextBox5.Text = ListBox1.SelectedItem
End Sub
• C#
private void Form1_Load(object sender, EventArgs e)
{
// put some text in the large text window
textBox4.Text = textBox1.Text + (char)13 + (char)10 + textBox2.Text + (char)13 + (char)10 + textBox3.Text;
// select first item in the listbox
listBox1.SetSelected(0, true);
textBox5.Text = (string)listBox1.SelectedItem;
}
This routine initializes some text controls and the list box selection.
|