What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » VB 6 User help

VB 6 User help
Author: Message:
macbrutal
New Member
*


Posts: 1
Joined: Jan 2008
O.P. VB 6 User help
Hi, i'm new at visual basic so you know..
My latest program is a Userprogram, and the coding is done
except that my files gets overwritten when i'm saving it..
----------------------------------------------------------------------------
Private Sub Command1_Click()
Dim namefile As String
namefile = Text1.Text

Open App.Path & "\Accounts\" + namefile + ".txt" For Output As #1
Print #1, Text1.Text
Print #1, Text2.Text
Print #1, Text3.Text
Print #1, Text4.Text
Close #1

MsgBox "Msgbox"
End Sub
------------------------------------------------------------------------------
Can you paste back the code but with the code so the file dont
get overwritten, please?
01-23-2008 05:32 PM
Profile E-Mail PM Find Quote Report
freak544
Full Member
***

Avatar

Posts: 245
Reputation: 2
36 / Male / Flag
Joined: Dec 2007
RE: VB 6 User help
if text1.text is the same each time then the file will be overwritten as your saving it as the same file name
01-23-2008 06:35 PM
Profile E-Mail PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: VB 6 User help
^o) If you want to add text to the end of the file use this instead, For Output overwrites/creates files, Input reads files and Append adds to files

code:
Private Sub Command1_Click()
Dim namefile As String
namefile = Text1.Text

Open App.Path & "\Accounts\" + namefile + ".txt" For Append As #1
Print #1, Text1.Text
Print #1, Text2.Text
Print #1, Text3.Text
Print #1, Text4.Text
Close #1

MsgBox "Msgbox"
End Sub


This post was edited on 01-23-2008 at 06:48 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
01-23-2008 06:47 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On