Saving and integers to a file

[b][red]This message was edited by TechZimmy at 2004-6-30 17:17:31[/red][/b][hr]
I need to make a program that saves its position on the screen to a file so when you load it again it will be in the same place that it was last time. I also need to save some text in the file. So far for the saving part I have this:
[CODE]
Open "C:Position.dat" For Output As #1
Write #1, txtName.Text
Write #1, Val(form1.Left)
Write #1, Val(Form1.Top)
Close #1
[/CODE]
And for the loading part I have this (FLeft and FTop are declared as integers, FName is a string):
[CODE]
Open "C:Position.dat" For Input As #1
Input #1, FName
Input #1, FLeft
Input #1, FTop
Close #1
txtName.Text = FName
Me.Left = FLeft
Me.Top = FTop
[/CODE]
It never works. Is it possible to save a number to a file and get it back as a number?

Adam


Comments

  • : [b][red]This message was edited by TechZimmy at 2004-6-30 17:17:31[/red][/b][hr]
    : I need to make a program that saves its position on the screen to a file so when you load it again it will be in the same place that it was last time. I also need to save some text in the file. So far for the saving part I have this:
    : [CODE]
    : Open "C:Position.dat" For Output As #1
    : Write #1, txtName.Text
    : Write #1, Val(form1.Left)
    : Write #1, Val(Form1.Top)
    : Close #1
    : [/CODE]
    : And for the loading part I have this (FLeft and FTop are declared as integers, FName is a string):
    : [CODE]
    : Open "C:Position.dat" For Input As #1
    : Input #1, FName
    : Input #1, FLeft
    : Input #1, FTop
    : Close #1
    : txtName.Text = FName
    : Me.Left = FLeft
    : Me.Top = FTop
    : [/CODE]
    : It never works. Is it possible to save a number to a file and get it back as a number?
    :
    : Adam
    :
    :
    :

    I figured it out! The form had not yet shown when the variables were loaded.
    Adam
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion