示例#1
0
 public static void DataGridViewAddRow(DataGridView ctrl, params object[] args)
 {
     if (ctrl.InvokeRequired)
     {
         DataGridViewAddRowDelegate del = new DataGridViewAddRowDelegate(DataGridViewAddRow);
         ctrl.Invoke(del, args);
     }
     else
     {
         ctrl.Rows.Add(args);
     }
 }
示例#2
0
 public void DataGridViewAddRow(string host)
 {
     if (dataGridView.InvokeRequired)
     {
         // this is worker thread
         DataGridViewAddRowDelegate delegateAddRow =
             new DataGridViewAddRowDelegate(DataGridViewAddRow);
         dataGridView.Invoke(delegateAddRow, host);
     }
     else
     {
         // this is UI thread
         // formating data
         host = host.Replace("\t", "");
         host = host.Replace("\r\n", "");
         host = host.Replace(" ", "");
         // add line.
         if (!string.IsNullOrEmpty(host))
         {
             dataGridView.Rows.Add(host);
         }
     }
 }
示例#3
0
 public void DataGridViewAddRow(string host)
 {
     if (dataGridView.InvokeRequired)
     {
         // this is worker thread
         DataGridViewAddRowDelegate delegateAddRow =
             new DataGridViewAddRowDelegate(DataGridViewAddRow);
         dataGridView.Invoke(delegateAddRow, host);
     }
     else
     {
         // this is UI thread
         // formating data
         host = host.Replace("\t", "");
         host = host.Replace("\r\n", "");
         host = host.Replace(" ", "");
         // add line.
         if (!string.IsNullOrEmpty(host))
         {
             dataGridView.Rows.Add(host);
         }
     }
 }