473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DatagridView Shows Removed Table

I have a DataGridView in a form that will display the information
from
various DataTables in my DataSet. The user is provided a list of
tables and when they select a table name, the DataGridView displays
the appropriate DataTable. When a user changes some of the settings
in my program, I sometimes have to recreate some of the DataTables,
however, the DataGridView will still somehow display the original
DataTable even if the DataGridView had never displayed the original
table in the first place. Does anyone know why this would be
occurring?

I run the following code when I need to recreate a table:
//Remove existing table if there is one
if
(_dsDifferences.Tables.Contains(diffDataTable.Tabl eName) &&
_dsDifferences.Tables.CanRemove(diffDataTable.Tabl eName))
{
_dsDifferences.Tables.Remove(diffDataTable.TableNa me);
}
//Add the Differences Data Table to the Differences
Dataset
_dsDifferences.Tables.Add(diffDataTable);
When the user selects a table, I run the following:
dgDataDiffs.DataMember = "";
dgDataDiffs.DataSource = null;
dgDataDiffs.DataSource = _ds;
dgDataDiffs.DataMember = lstDataDiff.SelectedItem.ToString();
dgDataDiffs.AutoGenerateColumns = true;
The weird thing is, is that when I break into the code and look at my
dataset (_ds), the DataTable is the newly created datatable, so I
know
the table is getting recreated. The only solution I seem to be able
to come up with is to make a Copy of the Dataset and bind the copy to
the DataGridView, however, that is not feasible.
One thing I should add, is if I simply create a DataTable in a
dataset, then remove the table and create another DataTable with the
same name and then bind my DataSet/DataTable to a DataGridView that
was never bound to anything, the DataGridView shows the original
table. It seems like there is something I need to do after issuing
the Remove statement, but I don't know what it is.
Thanks,
Chris

Aug 21 '07 #1
0 1043

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob | last post by:
During a form's development I noticed that when I changed bound dataset defintions with the dataset designer (for instance adding a column to one), when I come back and look at the form the...
3
by: Danny Nielsen | last post by:
Hi I am having trouble figuring out how to use combobox in a datagridview. What seemed to be a simple task turned out not to arrghh. I have a dataGridView with 4 columns, one of them is column...
0
by: TNSFED | last post by:
I have a dilemma when trying to delete a row from the DataGridView. Here is a sample of my code: private void dgv_EQUPS_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e) {...
11
by: Kevin | last post by:
I've been searching forever for examples of saving data changes in a DataGridView. There's all kinds of examples, but none really show how to save changes. Someone please help me. I have a...
8
by: Brian Pelton | last post by:
This is on .Net 2.0 in a WinForms application. I have a DataGridView that is bound to a BindingSource. The DataGridView has 3 columns. The first two are "normal" text columns and the last is a...
1
by: kristian | last post by:
Hi all I have a simple form with not much more than a datagridview control, and want to show and edit the contents of a table in my mysql table. So far I have managed to set the db table as a...
0
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I am a .NET newbie, specifically WinForms. I have a simple Winform for which I have a "How To" question: My WinForm app will display data from a FoxPro database, two tables in particular:...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: Chris | last post by:
I have a DataGridView in a form that will display the information from various DataTables in my DataSet. The user is provided a list of tables and when they select a table name, the DataGridView...
6
by: =?Utf-8?B?TU1TSkVE?= | last post by:
How to let user delete multi rows from the BindingSource while the SelectionMode Property set to RowHeaderSelect I have in my program datagridview bound it to sql table Throw Bindingsource To...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.