Friday 15 August 2014

c# - Datagridview adds up unwanted rows -


The last line of this code is "3" and 3 columns with "columns" and "umidita" relevant text boxes Are shown in

This data comes from the serial port and updates every x seconds.

  Private zero set text (string text) {string mendetura; String umidita; If (this.txtOutput.InvokeRequired) {SetTextCallback D = New SetTextCallback (SetText); This.BininWolk (D, new object [] {text}); } Other {string f = text; Four first class = f [0]; If (fictitious == 't') {temperatura = f; Temperatura = f.Replace ("T", ""); Textbox1.Text = temperatura; } And if (primarily == 'U') {umidita = f; Umidita = f.Replace ("U", ""); Textbox2.Text = umidita; } DataGridView1.Rows.Add (new string [] {DateTime.Now.ToString ("HH: mm: SS"), textbox 1. text, text box 2. text}); }}   

This code is working but I get 3 rows while filling it with the same data.

Enter image details here

I'm familiar with the DataGride View I am not and I do not understand why I am behaving like this. What do I need to do to get a line across over time, "Mendreretra" and "umidita"?

/// / You can check whether you have already entered a line at the moment < / P>

  int rowsCount = dataGridView1.Rows.Count; String cuurentTime = DateTime.Now.ToString ("HH: mm: SS"); If (cuurentTime! = DataGridView1.Rows [rows number -1]. Cell [0]. Value toString ()) {dataGridView1.Rows.Add (new string [] {cuurentTime, textBox1.Text, textBox2.Text}); }    

No comments:

Post a Comment