Home > Net >  Help winfrom, DataGridView control how real-time updates a row, rather than inserting a new row.
Help winfrom, DataGridView control how real-time updates a row, rather than inserting a new row.

Time:04-18


Pictured above, after insert 4 lines or n rows of data, the same logo line, no longer insert, but data, update the logo line (marks, only for 1, 2, 3... )
 private void Page_Channel_Load (object sender, EventArgs e) 
{
UiDataGridView1. AddColumn (" serial number ", "Column1). SetFixedMode (70);
UiDataGridView1. AddColumn (" Station ", "Column2");
UiDataGridView1. AddColumn (" ECD (us) ", "Column3");
UiDataGridView1. AddColumn (" FLD (dBuV) ", "Column4");
UiDataGridView1. AddColumn (" Tran (us) ", "Column5");
UiDataGridView1. AddColumn (" Base (us) ", "Column6");
Skyfld uiDataGridView1. AddColumn (" 1 ", "Column7");
UiDataGridView1. AddColumn (" 1 delay (us) ", "Column8");
Skyfld uiDataGridView1. AddColumn (" 2 ", "Column9");
UiDataGridView1. AddColumn (" 2 delay (us) ", "Column10");

UiDataGridView1. ReadOnly=true;
}

Public class Data
{
Public string Column1 {get; set; }
Public string Column2 {get; set; }
Public string Column3 {get; set; }
Public string Column4 {get; set; }
Public string Column5 {get; set; }
Public string Column6 {get; set; }
Public string Column7 {get; set; }
Public string Column8 {get; set; }
Public string Column9 {get; set; }
Public string Column10 {get; set; }

Public override string ToString ()
{
Return Column1;
}
}

//update the DataGridView function,
Public void Update_chain_Info (LSCHM_Decode_T chain_info)
{
DataGridViewRow row=new DataGridViewRow ();

Row. CreateCells (uiDataGridView1);
//num is a unique identifier, if the identifier is the same, then update the data, rather than insert new lines
Row. The Cells [0]. Value=https://bbs.csdn.net/topics/num.ToString ();
Row. The Cells [1]. The Value=https://bbs.csdn.net/topics/chain_info.period + "" + chain_info. State;
Row. The Cells [2]. Value=https://bbs.csdn.net/topics/chain_info.ecd;
Row. The Cells [3]. The Value=https://bbs.csdn.net/topics/chain_info.fld;
Row. The Cells [4]. The Value=https://bbs.csdn.net/topics/chain_info.transport_delay;
Row. The Cells [5]. Value=https://bbs.csdn.net/topics/chain_info.base_delay;
Row. The Cells [6]. Value=https://bbs.csdn.net/topics/chain_info.one_sky_fld;
Row. The Cells [7]. Value=https://bbs.csdn.net/topics/chain_info.one_sky_delay;
Row. The Cells [8]. Value=https://bbs.csdn.net/topics/chain_info.two_sky_delay;
Row. The Cells [9]. Value=https://bbs.csdn.net/topics/chain_info.two_sky_fld;
UiDataGridView1. Rows. The Add (row);

}


If this error again

Please help give some idea of what a great god, or reference routines, no matter what all can, thank you thank you!

CodePudding user response:

I didn't fully understand this, your complete requirements,
Only shows that table rows insert or update, is judged by the line mark 1, 2, 3, 4,

If the logo is the same, that is, for the update, if the logo does not exist, is the insert,

That I want to ask, that the first figure is how to understand, identify, 1234, 3 times the same data line?
  •  Tags:  
  • C#
  • Related