944,057 Members | Top Members by Rank

Ad:
Nov 24th, 2007
0

VB Advanced TEXT BOX problems

Expand Post »
I am using Visual basic 6
I am trying to create a new txt file with the textbox (text1) contents.
But instead of calling that text file "Stored.txt" as I currently am doing, I am trying to create the new .txt file with the text from the textbox.

Private Sub Command1_Click()
Dim F As Integer 'Setup up constant file number
F = FreeFile ' Set F to the next free file number
'open file Text.txt
Open ("C:\PROGRA~1\ASTKA\SADM\info\Stored.txt) For Append As F
'write text to file
Print #F,
Print #F, "First Name:", Text1.Text
Print #F, "Last Name:", Text2.Text ' Normaly this info will get stored in the registery!
Print #F,
Print #F,
'Close file
Close #F


End Sub

So basically, if someone enters their "First Name" in the textbox (text1) it will not only write it to a file in: C:\PROGRA~1\ASTKA\SADM\info\ but it will name it based on the contents of "text1" so if someone enters "bob" that new text file will be called "bob.txt" and it will contain "firstname: bob" (at the same time) I do not want a static name "Stored" for every persons name, I want the file to change and create new ones for everyones name, and the files will be named each persons name.
Any help?? I've searched and searched and found nothing.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jackfarrel is offline Offline
3 posts
since Nov 2007
Nov 25th, 2007
0

Re: VB Advanced TEXT BOX problems

No problem man! Check this

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Open Text1.Text & ".txt" For Output As #1
  2. For n = 0 To 5
  3. Print #1, Text2.Text
  4. Next n
  5. Close #1
Last edited by steve585; Nov 25th, 2007 at 6:48 am.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
steve585 is offline Offline
14 posts
since Nov 2007
Nov 25th, 2007
0

Re: VB Advanced TEXT BOX problems

I found the solution:


Private Sub Command1_Click()
Text2.Text = Date
Dim F As Integer 'Setup up constant file number
Dim filepathname As String
F = FreeFile ' Set F to the next free file number
'open file Text.txt
filepathname = "C:\PROGRA~1\ASTKA\SADM\info\" & Text1.Text & ".Doc"
Open (filepathname) For Append As F
Print #F,
Print #F, "Full Name:", Text1.Text
Print #F, "Date of attendance:", Text2.Text ' Normaly this info will get stored in the registery!
Print #F,
Print #F,
'Close file
Close #F
End Sub
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jackfarrel is offline Offline
3 posts
since Nov 2007
Apr 25th, 2010
0
Re: VB Advanced TEXT BOX problems
Yo JackFarrel, my hero man, is that you? Why are you messing with VB things! If you recognize "PERL TOPIA" contact me you know what it means, and where I used to be, been looking everywhere for you!
Your not that hard to track. >---<
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Hacker3 is offline Offline
1 posts
since Apr 2010

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Datareports in VB6 using Parent-Child Commands
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: number plate recognition system





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC