Solved

Datagridview column problem

Posted on 2014-02-06
1
297 Views
Last Modified: 2014-02-06
I have a listbox with names of tables in a SQL server database. The user selects a table in the list, and the datagridview below populates with that table. However, every time the user selects a different table in the list, the columns from the previous table remain in the DGV, and the new ones are added, so with every click in the listbox I have an ever expanding set of columns in the DGV.
0
Comment
Question by:TimHudspith
1 Comment
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 39840798
dataGridView1.CancelEdit() 'In the case that the user is currently editing a cell
dataGridView1.Columns.Clear()
dataGridView1.DataSource = Nothing

Then call back the code that fills the grid
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now