Link to home
Start Free TrialLog in
Avatar of AAbomber98
AAbomber98

asked on

Saving and opening Text

Hello
This is alex and i am a beginger :( in VB.
I made a imitation of notepad. I have gotten it to print and chage fonts ect..
I have not been able to get it to save or open files.
I want it to Save/Open the text in the textbox but cant figure out how.
The textbox is caled TextBox The Save butten is called save and the open butten is caled save.
Open to ideas
Thanks
Avatar of JoaTex
JoaTex

Hi

Here is the code:

Private Sub CommandOpen_Click()
    Dim A As String
    Open App.Path & "MyText.txt" For Input As 1
    A = Input(LOF(1), 1)
    Close 1
    TextBox.Text = A
End Sub

Private Sub CommandSave_Click()
    Open App.Path & "MyText.txt" For Output As 1
    Write #1, "TextBox.Text"
    Close #1
End Sub

Jo
Avatar of AAbomber98

ASKER

Sorry i tryed but i did not work.
it would print "TextBox.text" in the textbox when i tryed to open it.

i would also like to able to specify and name where and what i want to call it.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of JoaTex
JoaTex

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial