Results 1 to 6 of 6

Thread: Working with a database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2009
    Location
    Denmark
    Posts
    132

    Question Working with a database

    I just got a simple question:

    When you are working with a database, is it then possible to make the program save stuff, so when you close and open the program, it could etc. save a text in a textbox?
    Eldrup

  2. #2
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Working with a database

    You need to call the save-procedure in the Close_event
    What code do you have already?


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2009
    Location
    Denmark
    Posts
    132

    Re: Working with a database

    Explain, im new at this point. =)
    I dont have any code, but i just wanted to now, how to save the things...
    Eldrup

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Working with a database

    I would suggest that you read the FAQ thread at the top of the Database Development forum and follow the relevant links for ADO.NET explanations and examples.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Hyperactive Member
    Join Date
    Jun 2008
    Posts
    407

    Re: Working with a database

    This is actually quite simple. When the user hits the close application button you want to simple write whatever information you need to your database and then close the application. So in your example saving a text box data what you'd need to do is on the close event write the text box data to your database then close out the application. When you open the application in the "on load" procedure just open a connection to your data base pull the information from the database and then write it to your text box.
    My Websites
    SharpMP3 - MP3 Design Articles www.sharpmp3.com
    Yobbers - Job Search www.yobbers.com
    Lets Trend - Methods For Riding Stock Trends www.letstrend.com

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,102

    Re: Working with a database

    I have a question about the question: While it is possible to save the text from a textbox to the database, is that where the data ought to be saved?

    Generally, programs that work with databases are written so that the user enters a few things, those few things are saved to the database when the user clicks a button, then the user enters a few more things, and so on. When you talk about saving the text in a textbox when the program closes, it makes me think that you just want to retain the current state of the program at the time that it was closed. This is done more easily using My.Settings than by saving the state to a database, though the database option would work.
    My usual boring signature: Nothing

Tags for this Thread

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