判斷輸入的值是否為數字
Double X,;
if (Double.TryParse(textBox1.Text, out X) == false) //使用int.tryparse出來會是布林值
{
MessageBox.Show("不可以輸入文字或空值", "錯誤");
}
文字顏色設定
label3.ForeColor = Color.Blue;
跳出訊息框
MessageBox.Show("不可以輸入負數", "錯誤");
核取方塊
http://visualcsharptutorials.com/windows-forms/checkbox-control
亂數的取法
Random rNumber = new Random();
target = rNumber.Next(1, 500);
label4.Text = target.ToString();
沒有留言:
張貼留言