Error reminder Control
If (this. textbox1.text. length> 12 | this. textbox1.text. length <6)
{
This. errorprovider1.seterror (this. textbox1, "username input error ");
Dialogresult returndlg = MessageBox. Show (this, "the user name is incorrect. Are you sure you want to enter it again? "," Information prompt ",
Messageboxbuttons. retrycancel, messageboxicon. Question );
Switch (returndlg)
{
Case dialogresult. Retry:
This. textbox1.text = "";
Break;
Case dialogresult. Cancel:
Break;
}
}
Use the information prompt control
This. tooltip1.settooltip (this. textbox1, "Enter the Student name. ");
Open a file
This. openfiledialog1.showdialog ();
String strfilename = This. openfiledialog1.filename;
If (strfilename. Trim () = "")
Return;
This. richtextbox1.loadfile (strfilename, richtextboxstreamtype. plaintext );
This. statusbarpanel1.text = "file name:" + strfilename;
Richtextbox‑mousemove
// Detect the mouse position
Int xpos = cursor. position. X;
Int ypos = cursor. position. Y;
This. statusbarpanel2.text = "mouse position: x =" + xpos. tostring () + "Y =" + ypos. tostring ();