Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7968845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:08:32+00:00 2026-06-04T07:08:32+00:00

I have a small dataset which has most of its schema defined at design

  • 0

I have a small dataset which has most of its schema defined at design time, but I add a few columns to one of its tables at runtime. My problem is how do I reset those changes?

The dataset is not linked to any datasource. It just has its own table which I “manually” populate. The static columns have been added to the datatable at design time. However, I add a few columns as runtime based on a list of categories. Like this:

For Each aCategory In theCategories
    theDataTable.Columns.Add(aCategory.CategoryName, System.Type.GetType("System.Boolean"))
Next

The dataset is used in a small dialog that pops up within my application. I add the dynamic columns when the dialog is opened by using the Load event. Everything works great the first time. But if you close the dialog and reopen it, there are problems. My startup routine tries adding the dynamic columns again, but an error is thrown saying the column already exists. I have tried a lot of things and did some reading but I can’t figure out a way to reset the dataset when the dialog is closed. The only solution is to close the whole application and reopen it. I have tried the following in the Leave event of the dialog form:

theDataSet.Reset()
theDataSet.Dispose()
theDataSet.RejectChanges()

None of these seem to make a difference and the error continues. I have also tried applying the same methods to the table in addition to the dataset. Such as:

theDataSet.Tables(0).Reset()
etc.

Any ideas on how to completely obliterate the dataset when the form closes? I gave my examples in VB, but I can digest answers in either VB or C#.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:08:33+00:00Added an answer on June 4, 2026 at 7:08 am

    I have answered my own question. It turns out that my problem was not really anything to do with datasets or datatables but rather dialog boxes.

    I was calling the form in which the dataset was used as follows:

    ActionsSettingsForm.ShowDialog()
    

    After reading this article: http://msdn.microsoft.com/en-us/library/aw58wzka.aspx I realized that the dispose method is only automatically called if you use .show not .showdialog. So i changed the code that called the form to:

    ActionsSettingsForm.ShowDialog()
    ActionsSettingsForm.Dispose()
    

    And it solved the problem. Now all the objects associated with the form are properly disposed when the form closes. Which means that the dataset is reset to its design time default, or rather a new one is created when the form is opened again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have big dataset (but the following is small one for example). I can
I have small script in bash, which is generating graphs via gnuplot. Everything works
Hallo, I have a dataset with a datatable which is frequently transmitted via WCF
I have a query which is taking a very very long time to execute
I have two big and small dataframes (actually dataset is very very big !).
I have a large typed dataset which I want to partially fill for unit
I have a small N large T panel which I am estimating via plm::plm
We have a small data set and would like to search through it in
have small problem, and would very much appreciate help :) I should convert byte
I have small query today I happen to see when I typed a website

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.