Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello all, Newbie all around here, in VB as well as this forum.

I am starting to learn the realms of VB. Having intermediate knowledge on HTML/PHP/MySQL code, I find VB to be easier to learn.

With that said, please treat me as a newbie. :)

My question is as the title states: I need to have a direction on how to create a snippet of code.

I would like for my users to click on a button or menu entry and be able to import/export the data in a table, for backup purposes. Í have no code to show as I don't even know where to begin. Not asking for you to do my work, just an example or a point to the right direction will do, as I have been looking for 2 days all over Google and I am starting to get frustrated.

It would be super nice to have it all contained inside the little project, and no API or third party tools, so I can actually learn what I am doing.

This is a project that may be going nowhere, I am just trying to learn. Then again, could be the basis for a few ideas I have...

Thanks!
Posted
Updated 23-Jul-10 9:21am
v3
Comments
TheyCallMeMrJames 23-Jul-10 16:34pm    
Reason for my vote of 5
Good honest question from someone who isn't assuming they are 'l33t' and gracing us with their question.
TheyCallMeMrJames 23-Jul-10 16:41pm    
Are you working on a Windows application or a web site?
Mordred69 24-Jul-10 0:18am    
I thought I had written an answer to this about 5 minutes after you posted this, MrJames... I guess I did not click on the "Submit Comment" or it just didn't post.

This is a very basic Windows application. What I am trying to accomplish is to learn how to take the data from a table and put it on a CSV or a txt file. The user should be able to then take that csv or txt file and save it someplace as a data backup and then be able to import it.

Thank you.

1 solution

I would expect that you would not work with the control at all. Your data table will be built typically from a data source, such as a dataset. As a result, I would consider the data table to only be a view to the data, and work with the data directly to create the file you want. The File class has static methods like WriteAllText and WriteAllLines, so I would iterate over the data source, create a string array ( I'd probably use the List class and call ToArray at the end ), then call a method to save the data.
 
Share this answer
 
Comments
Mordred69 24-Jul-10 0:22am    
Thank you, Christian Graus. Now, can you (or anyone else, for that matter) point me as to how I go about gathering the information from the datatable?

The main roadblock for me now is, I don't really know how to construct the query code inside the vb form so I can use with a click event. By using the snippets provided inside the program, I can see how to make a database connection, but I am not sure how to go start the query.

I will keep looking around google to see if I can learn something. Thanks for the logical explination; I can now see how I can build this, at least the file creation side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900