PC Review


Reply
Thread Tools Rate Thread

DataTable/DataGridView/Singleton

 
 
Nathan
Guest
Posts: n/a
 
      10th May 2009
I have a DataTable that is in a singleton class; the data is loaded
from an XML file, or created by the user at runtime in a DGV. I have
no problems with adding or deleteing rows at first. My problem occurs
when I close that form and populate the data in a new form by binding
a DGV in the new form to the same datatable/singleton class.

In the new form, if a user then tries to delete a row that was
previously added (in the first form), there are no problems. But if
they add a new row (through the datagridview), and then try to delete
that row, I get an error like this: "Error: Index 6 does not have a
value." And, the error keeps looping and popping up, freezing the
application.

I am wondering if my use of a singleton class is causing the problem.
If there is a better way to preserve the same class instance (with its
datatable) through my entire project besides a singleton, I would be
open to a change! My datatable is not tied to an external database,
as I am only keeping track of small amounts of data for a short term.

Any help would be appreciated - I'm a novice C#/.NET programmer.

Thanks,
Nathan
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataTable/DataGridView/Singleton Nathan Microsoft C# .NET 0 10th May 2009 09:31 PM
A DataTable-bound DataGridView throws a low-level Exception whencolumns are sorted, removed and re-added to the underlying DataTable. Sath123 Microsoft Dot NET Framework Forms 1 12th May 2008 12:51 PM
datagridview and datatable kjqua Microsoft C# .NET 3 19th Feb 2008 05:15 AM
Strongly typed datased (it's datatable) as singleton =?iso-8859-1?B?Smly7SBOZXV6aWw=?= Microsoft ADO .NET 1 29th Dec 2006 12:21 PM
DataTable and DataGridView Ilya Dyoshin Microsoft ADO .NET 8 10th Jan 2006 08:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:18 PM.