Jump to content

Save data question/help please.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
Kim2

Kim2

    Newbie

  • Members
  • Pip
  • 1 posts
Hello,

Iam learing Visual Studio 2008 C# and iam making a window where I can type in how much money i spend each week.

I want this information to save somewhere so I can see how it changes from week to week.

My question is, should I connect my form to an database to be able to do this? Or can this be done in other ways?

Also, what databse should I use if I need one. (a free one ofcourse)

Thanks,

#2
X_Programmer

X_Programmer

    Learning Programmer

  • Members
  • PipPipPip
  • 89 posts
If it's just an amount can't you save it as a text file?

When you close the form call up the closing event and save what you wrote on the form to a text file.
On the formload event load the text file and display the contents in the textbox(or where ever you want to display it).

If you need more help I can show you some sample code.

#3
QuackWare

QuackWare

    Learning Programmer

  • Members
  • PipPipPip
  • 95 posts
If you don't want to have to save it to an outside file like a text file you can look into using the Resources section of your application (Pretty easy if you use Visual Studio 2008). This still creates a file but one out of reach for the average user of your program.

#4
QuackWare

QuackWare

    Learning Programmer

  • Members
  • PipPipPip
  • 95 posts
If you don't want to have to save it to an outside file like a text file you can look into using the Resources section of your application (Pretty easy if you use Visual Studio 2008). This still creates a file but one out of reach for the average user of your program.

#5
Delever

Delever

    Newbie

  • Members
  • Pip
  • 3 posts
You can use SQLite for small database. Well, if you know SQL or after you learn it of course ;)

csharp-sqlite - Project Hosting on Google Code

#6
cdg10620

cdg10620

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 389 posts
If I was doing something like that and I didn't want to use a database I would serialize the data and save it in an xml page. That makes working with strongly typed objects very simple in C#.
-CDG10620
Software Developer

#7
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
try this dude

1.Open Notepad

2.Type in the .LOG as the first line , save and close it

3.Reopen the file you will have Date and Time prefixed to the current line.

4.Go ahead and type the ammount spent. thats it. ;D