這裏是我的代碼不能RichTextBox的中數行數
private void Allocation_Matrix_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
int Total_Row_Check;
Total_Row_Check = getRow();
Textbox1.Text = Convert.ToString(Total_Row_Check);
if (Total_Row_Check >= Convert.ToInt32(Total_Processes.Text))
{
MessageBox.Show("rows cannot exceed from total number of processess");
}
}
}
public int getRow()
{
int Row = 0;
string[] arLines;
int i;
arLines = Allocation_Matrix.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
for (i = 0; i < arLines.Length; i++)
{
Row++;
}
return Row;
}
我想更新TextBox1的我敲擊回車鍵從鍵盤的RichTextBox ...但文本框只保留顯示FIRSTROW並顯示一( 1)
公衆詮釋GetRows的() { 串[] arLines; int i; arLines = Allocation_Matrix.Text.Split(new string [] {Environment.NewLine},StringSplitOptions.None);對於(i = 0; i
2010-12-03 06:00:09
上面的代碼正在工作.....然後你錯了:( – 2010-12-03 06:02:06