Results 1 to 3 of 3

Thread: [RESOLVED] Store datatable in My.Settings

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Resolved [RESOLVED] Store datatable in My.Settings

    Hi
    I would like to store data in form of table in the application setting with user scope.

    1-Can a datatable be stored in My.Settings? I thought of “System.Collections.Specialized.StringCollection” but have no idea if that is the right approach. How exactly is that done?

    2-How will I initialize the column names etc?

    Thanks in advance for any help.

    A note: my users will only have the .exe file of the application i.e. no installation etc.

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Store datatable in My.Settings

    Yes, a datatable can be stored in My.Settings.
    You can't define the datatable parameters when adding the datatable to the Settings in the IDE, but need to store the table initially from code. That means testing the table in My.Settings to see if it is Nothing, and if so, create a table and save it, otherwise, you can load the table from My.Settings.

    So, add an entry to My.Settings of DataTable type, then add code to access it. I know the topic has come up before, so I'll search for the previous post...

    Here is the post I was thinking of.
    Last edited by passel; Feb 28th, 2019 at 08:14 AM.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2018
    Posts
    514

    Re: Store datatable in My.Settings

    Thank you. I managed to get things rolling. My problem was that 1- I could not find the datatable datatype in the setting 2- figure out how to add columns

    After reading your post and the other one, I managed both now.

    Thank again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width