Remove horizontal scroll bar if no data exists in datagridview
I have a tree-view and datagridview on my form.
I will have an import option through which I can import txt files. When I select a particular file I will add it as a node to the tree-view and the d开发者_开发知识库ata in that file will be displayed in the datagridview.
I will also have a context menu that has some options such as Close which will be displayed on Tree-view right click. If I select Close I will clear all the Nodes of tree-view and clear all rows of the datagridview.
But the horizontal scroll bar is not getting cleared can any one tell how to clear this?
you need to clear the columns of the datagridview
dataGridView1.Columns.Clear();
and before adding new rows. need to add columns using
dataGridView1.Columns.Add("Column_Name", "Header_Text");
精彩评论