By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,462 Members | 799 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,462 IT Pros & Developers. It's quick & easy.

How to save text data in my programme

P: 21
hi,
is any one can help me? i have create a form and it have 3 text boxes..and i want to type some data in that text boxes and when i click save button i want to save that data in my form...i don't know how to do it...please any one can teach me to do that ...
thank you
Apr 10 '07 #1
Share this Question
Share on Google+
6 Replies


Expert 5K+
P: 8,434
hi,
is any one can help me? i have create a form and it have 3 text boxes..and i want to type some data in that text boxes and when i click save button i want to save that data in my form...i don't know how to do it...please any one can teach me to do that ...
Open a text file, write the information into it, close the file.

There are two techniques you would be likely to use. (I'm going to assume you're using VB6 - you didn't say).
  • Simpler to code, but providing less functionality, is the use of the Open...Close and various related statements.
  • The FileSystemObject requires you to add Microsoft Scripting Runtime to your project (under Project | References), and takes a little more work. But it provides a lot more power to work with files, folders and drives.
For more information, you should look up the various statements (such as Open, Close, Get, Input # and so on) and the FileSystemObject in your documentation.
Apr 10 '07 #2

P: 21
sorry i can't understand...i'm using vb6 and can u please send cord's? and metod to how to do it...
thank u
Apr 10 '07 #3

Expert 5K+
P: 8,434
sorry i can't understand...i'm using vb6 and can u please send cord's? and metod to how to do it...
thank u
It would really be better if you read the documentation and explore this stuff. The main purpose of TheScripts is to provide help when programmers are stuck on a particular problem in their code. We're not a school.

Also, quite a lot of students come here and try to get copy-and-paste answers to homework and coursework assignments. Providing them doesn't help the student, and on occasion has actually gotten them into serious trouble with their teachers.

So, for many reasons, we try not to provide hand-holding at the beginner level. Sorry, but as you can see there are good reasons for this policy. And there are web sites out there which will provide basic tutorials, if you search for them. For that matter, if you use the search facility here on TheScripts, chances are good you will find what you're after anyway. I'm sure basic file access must have been discussed at various times.
Apr 10 '07 #4

P: 47
hi,
is any one can help me? i have create a form and it have 3 text boxes..and i want to type some data in that text boxes and when i click save button i want to save that data in my form...i don't know how to do it...please any one can teach me to do that ...
thank you
hello,
befofe using the code add reference from Project--->reference
"Microsoft Scripting Runtime"
Expand|Select|Wrap|Line Numbers
  1. Dim fsys As New FileSystemObject
  2. Dim Txtfl As TextStream
  3.  
  4.  Set Txtfl = fsys.CreateTextFile(app.path & "\"  & "CAADVREG.txt", True)
  5. Txtfl.WriteLine text1.text
  6. Txtfl.WriteLine text2.text
  7. Txtfl.WriteLine tex3.text
  8. txtfl.close
  9.  
Apr 10 '07 #5

P: 2
I read this on another site, and I think it works

Declarations:
Expand|Select|Wrap|Line Numbers
  1. Private myString As String
To Retrieve Data:
Expand|Select|Wrap|Line Numbers
  1. myString = GetSetting("myApp", "Settings", "myString", vbNullString)
  2. Textbox1.Text = myString
  3. myString = GetSetting("myApp", "Settings", "myString2", vbNullString)
  4. Textbox2.Text = mystring
  5. myString = GetSetting("myApp", "Settings", "myString*and so on*", vbNullString)
  6. Textbox3.Text = mystring
To Set Data:
Expand|Select|Wrap|Line Numbers
  1. myString = Textbox1.Text
  2. SaveSetting "myApp", "Settings", "myString", myString
  3. myString = Textbox2.Text
  4. SaveSetting "myApp", "Settings", "myString2", myString
  5. myString = Textbox3.Text
  6. SaveSetting "myApp", "Settings", "myString*and so on*", myString
Apr 10 '07 #6

Expert 5K+
P: 8,434
I read this on another site, and I think it works
...
I think you will find that the SaveSetting and GetSetting funtions are for reading and writing values in the Registry. As such, they probably should be used with some care, and preferably after reading the documentation.
Apr 11 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.