|
-
Jul 2nd, 2000, 02:14 PM
#1
Thread Starter
Addicted Member
How would I be able to save whats in a textbox, to a text document?
eg: You click the save button, and a message pops up asking you what you want to name it, and then it saves in programs directory?
I would really appreciate the help thanks!
-
Jul 2nd, 2000, 02:56 PM
#2
transcendental analytic
1. put a cmdialog control on your form, name it cmd
2. make a commandbutton and a textbox
3. put this code in your form
Code:
Private Sub Command1_Click()
dim ff as integer
On Error Resume Next
cmd.ShowSave
If Err Then Exit Sub
ff = FreeFile
Open cmd.filename For Binary As #ff
If Err Then Exit Sub
Put ff, , Text1
Close ff
End Sub
4. pressing the button will now show up a savedialog and save it if you choose a correct name.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 2nd, 2000, 08:35 PM
#3
Kedaman, Why would you use Binary and not Output?
Code:
Private Sub Command1_Click()
On Error Resume Next
commondialog1.ShowSave
Open commondialog1.filename For Output As #1
Print #1, Text1
Close #1
End Sub
[Edited by Matthew Gates on 07-03-2000 at 09:41 AM]
-
Jul 3rd, 2000, 03:33 AM
#4
transcendental analytic
Is there a particular difference in this case?
Don't leave the cancelerror unhandled Matthew or you will save a file whether you press cancel or not.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 3rd, 2000, 01:54 PM
#5
Code:
If Err Then Exit Sub 'fixed
Oops. That was just an example anyway Kedaman. I guess there is no difference.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|