C#換行、連接符號
寫程式過程中,會遇到需要串很多字串或一行中需要寫很長,為了增加閱讀及維護性,通常會採用換行、連接符號。 範例參考︰ 1. 使用【 + 】符號 - 連接符號 string strSQL= "SELECT * FROM Flight_Schedule AS F" + " INNER JOIN System_Code AS S" + " ON F.Formno = c.Code_Desc1" + " ORDER BY F.Formno"; 2.使用【 @ 】符號 - 連接符號 string strSQL= @" SELECT * FROM Flight_Schedule AS F INNER JOIN System_Code AS S ON F.Formno = c.Code_Desc1 ORDER BY F.Formno "; 標籤(Label)要換行" <br> " Ex︰ lb_other.Text = "編號:" + lb_sno.Text + " <br> " + "姓名:" + Txt_Name + " <br> " + "電話:" + Txt_Tel ; 文字盒(TextBox)要換行" \r\n " Ex︰ textBox1.Text = "編號:" + id + " \r\
留言
張貼留言