c# - How to save data and display it when I have some constraints -


its hard specify title...

i breaking head figure out problem,

i have packet including "data" "time" , "id".

i need save in data structure , display data in way on form (maybe datagridview), need ability rest packet info (time , id) when i'm clicking on displayed data.

for example:

0110 1110 0101 0001

the first data id 9 , time 2222. when click on first data (0110) need display (lets in lable on form) id = 9 , time = 2222.

one more thing, data must displayed way in above example (in row space between data.

edit: forgot important. if use databinding there option change data location on grid (based on packet info) cell/row another? if not maybe databinding not here.

if understand trying do, using datagridview, try this:

// datagridview  databing data source datagridview (use list of packet that)  --------------------------------- | data 1 | data 2 | data 3 | ... (header) --------------------------------- |  0110  |  1110  |  0101  | ... (data) --------------------------------- 

add event handler datagridview cellcontentclick, this:

private void mydatagrid_cellcontentclick(object sender, datagridviewcelleventargs e) {     if (e.rowindex > -1 && e.columnindex > -1) // row , cell selected     {         var packet = mydatagrid.rows[e.rowindex].databounditem packet;         if (packet != null)         {             // display packet information         }     } } 

hope helps.


Comments