5
Answers

Forced to display to the label after last row selected

Photo of Israel

Israel

7y
174
1
Hi!
 
Anyone can help please. I have these code and I need to display only the last row of datagrid on my label.
 
This first line it's works:
 
dgvNprint.CurrentCell = dgvNprint.Rows[dgvNprint.Rows.Count - 2].Cells[0];
 
the whole code:
 
...On Button_Click
  1. dgvNprint.CurrentCell = dgvNprint.Rows[dgvNprint.Rows.Count - 2].Cells[0];  
  2. string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\\table.mdb;Persist Security Info=False";  
  3. OleDbConnection sqlCon = newOleDbConnection(connectionString);  
  4. sqlCon.Open();  
  5. string commandString = "select * from companyname where S='order by ID" + '*' + "'";  
  6. OleDbCommand sqlCmd = newOleDbCommand(commandString, sqlCon);  
  7. OleDbDataReader read = sqlCmd.ExecuteReader();  
  8. while (read.Read())  
  9. {  
  10. lblNumberprint.Text = read["ID"].ToString(); // it will show your friend's name  
  11. }  
  12. sqlCon.Close();  

Answers (5)

0
Photo of Shefali Lahariya
NA 183 7.6k 7y
hi sagar, 
tits for sending i need for reciving notification and join call 
0
Photo of Sagar  Pandurang Kap
NA 2.7k 7.6k 7y
Hi,
Try below link :-
http://www.c-sharpcorner.com/UploadFile/pandeypradip/testing-of-push-notification-using-windows-form-application/
 
Hope it helps...