computer






 

Question by  secondbanana (289)

How do you clear your VB Net Clear datagridview?

I need to clear the view on my VB and have no idea how to do it.

 
+9

Answer by  tweety (266)

Lemme throw in one more code for you to try friend: DataGridView1. DataSource = Nothing DataGridView1. Refresh() If that clears your VB Net Clear datagridview you owe me a treat!

 
+7

Answer by  notanexpert (199)

Go to the Rows property and try calling the Clear method. This is the command you'll need to use: Me. DataGridView1. Rows. Clear() Let me know if this clears the VB Net Clear datagridview.

Reply by enlightened (206):
You could also try setting the DataSource to Nothing. This is simple and works at times!  add a comment
Reply by ross1976 (196):
Buddy, that will NOT work if it's bound to the data source unless you unbind the DataGridView first.  add a comment
 
+6

Answer by  cmc94 (302)

How did you add the rows. if it was manual, then this ought to work: if (this. dataGridView1. DataSource! = null) { this. dataGridView1. DataSource = null; } else { this. dataGridView1. Rows. Clear(); } The above command will clear the rows collection.

 
You have 50 words left!