hi i have a datagrid view that is filled with fields from a database. until filling this datagridview it is alright. in this form i have a button delete and a textbox. when i press this button it takes the number in the field which will be the primary key of the field(thats y i have a datagridview). the sql server database will also be updated and the field with the chosen primary key is deleted. the only problem i have is that i want to empty the datagridview from all data and refill it with the new fields(which excludes the deleted field). since now i have managed to refill the table again every time i delete something but it is not removing the fields i was seeing before... forexample
when i open the form i find:
id Name Surname
1 name1 surname1
2 name2 surname2
then when i fill the textbox with the number 2 and i press delete i get this
id Name Surname
1 name1 surname1
2 name2 surname2
1 name1 surname1
this means that the fields i had the first time i entered the form stood there but never deleted themselves...
i tried using
datagridview1.DataSource = null;
but it didnt work... anyone knows something how to empty data from a datagridview? or is it not possible?
thanks