Creating and Writing text in Text file or Notepad in Visual Basic 6.0 here the following procedure. In this example i have 1 text box in my form and 1 command button in my form. After clicking your command button basically it will create notepad and write text depending the text that you inputted in you text box. You can download this example below.
You can download my example below.
Download File
Its not working, check your code and upload proper code to site, please test before upload to site, dont let user to download codes
ReplyDeleteCreate the file but does not write on it
ReplyDeleteNot working.
ReplyDeletePrivate Sub Command1_Click()
ReplyDeleteDim val As String
'Creating text file==============================
Open "C:\textFile.txt" For Output As #1
Close #1
'================================================
'Writing text inside your text file============
val = Text1.Text
Open "C:\textFile.txt" For Output As #1
Print #1, val
'===============================================
MsgBox "Check you text file in drive C", vbExclamation
End Sub
I'm sorry for inconvenience, this one work 100%.
Thanks
how get text from note pad to lisbox
ReplyDeletepls hlep me for writing code in VB using text file ... for eg in text file the content as a 234 34 22 b 23 45 45 c 834 44 43 soon...
ReplyDeleteif i give a then i must get 234 34 22 and b means then 23 45 45 like this i need ... pls hepl me in creating
First thing to do open your vb6 and save it into a specific folder, then create a Textfile save it inside the folder that you've created and inside the textfile put this value as you given above.
ReplyDeleteTry this one.
Private Sub Command1_Click()
Dim str As String
Open App.Path & "\textfile.txt" For Input As #1
While Not EOF(1)
Line Input #1, str
List1.AddItem str
Wend
Close #1
End Sub
For writing in notepad, the code is fine, but my problem is that, after writing in notepad a break line append at the end of the file.
ReplyDeleteFor ex. if i write "Hello World" in notepad, and open the notepad, then the cursor blink at the first character, and when i click ctrl+end then the cursor blink in a new line rather the the last character ie. "d". I want the when i click ctrl+end the cursor must blink after d.
Thanks in advance, please help me if you know.
email me at : narendra@eoctagon.com
nice job! codes rather...hehehe CND™
ReplyDeleteHi..
ReplyDeletethis is running successfully,
thanks
Nantha
For writing in notepad, the code is fine, but my problem is that, after writing in notepad a break line append at the end of the file.
ReplyDeleteFor ex. if i write "Hello World" in notepad, and open the notepad, then the cursor blink at the first character, and when i click ctrl+end then the cursor blink in a new line rather the the last character ie. "d". I want the when i click ctrl+end the cursor must blink after d.
Thanks in advance, please help me if you know.
mail to:touchwithkarthik@gmail.com
I need to create a text file and a data base of MicroSoft Access with extension .txt and .mdb resp. at runtime through codding . Is there anyone who can help me !!
ReplyDeletei need to know the tags/codes to create commands like open,save,save as,find,print?
ReplyDeletehow to write to C file from textbox using vb6.0???
ReplyDeletehow do we create a text file
ReplyDeletehow to update a file
ReplyDeleteHello everyone, I wanna to ask you about "How to add data form VB_Form into Text file.
ReplyDeletePlease!help me, and send me with sample in the following Email: chheyleangpen@gmail.com
please help me
ReplyDeleteuse VB6
create a text file called contacts using Notepad (programs> accessories > Notepad) with n=15
records for storing their name,sex age ,telephone and email address that resembles the below.
"Hiba", "M",20,1234567,"aaa@yahoo.com"
"ahmed", "f",21,2345678,"bbb@yahoo.com"
"ali", "M",25,3456789,"ccc@yahoo.com"
write a program to read the file display contact information.
please help me how to get the first line of the notepad.?? to display into textbox
ReplyDelete