How do have inputted text saved in VB? For example, have user enter some text and then that person exits the app and then once the prog is started up again have that text entered show up.
TIA
+ Reply to Thread
Results 1 to 17 of 17
-
-
Idea for workaround:
Have the program read a text file each time it starts and save the input in that file. -
dea for workaround:
Have the program read a text file each time it starts and save the input in that file. -
Or maybe try this in a BAT-file (file.bat) It will save input in a file and open the file. It's not VB but it works...
set INPUT=
set /P INPUT=Type input: %=%
echo Your input was: %INPUT%
echo %input%>> file.txt
start C:\your_folder\file.txt
pause -
Save:
Open "C:\My Documents\savedfile.txt" for output as #1
Print #1, textbox.text
close #1
Open:
dim strtext as string
Open "C:\My Documents\savedfile.txt" for input as #1
Input #1, strtext
close #1
textbox.text = strtextA bird in the hand is worth a foot in the tush-Kelly Bundy -
I don't know much about VB, but I can tell you how I would do it in Java.
-I would declare I string variable
-Once the string is entered have the user click a button or press enter
-Once they do that have that string placed in a .txt file with given location
-Then when you start your program you tell it to read the txt file previously created.
I actually created a simple program not to far ago that uses something similar, that you're asking. I'll give you the code for it if you want it. But its in Java, which is way more complex than VB. And is also very long. -
Hey g_shocker182,
I can think of several different methods (none complicated) but the best way ultimately depends on the intended usage, so if you would give a brief description of what you’re working on it would be helpful. Also need to know if you’re developing in VB6 or Vb.NET
Anyways if you still need to sort this out tell us a little more about your project and I’ll be glad to help. -
I wanted to use it for future projects but I'm new to it (VB6).
basically want a box and button and once they hit the cmd have the inputted info saved into a txt file or something. And when another cmd is pressed later have that txt text show up in a label or text box.
Any help is appreciated. Some of the suggested have worked but not fully. -
VB5 comes with extensive help pages and sample code. I assume VB6 does the same.
Have you tried searching the help pages that come with VB6? I'm sure they have enough sample code in the help pages to get this simple task done.
Regards.Michael Tam
w: Morsels of Evidence -
VB5 had excellent help . VB6 went to the MSDN library which:
1. You may not have
2. Is completely disorganized and not context sensitive.
Progress ? 8) -
You can use the online msdn help if you are looking for a particular win32 function parameters/info at: msdn.microsoft.com. As to your question, you could always write the string to the registry and when the program loads up try and read that string from the registry for that label/textbox. there are various win32 registry functions that you can use in basically any high level programming language (i.e. c++ (for windows), VB, Delphi, etc).
-
Copy and paste the following into the the Declarations section of a form with a Text Box and 3 Command Buttons.
'------------------------------------------------------------------------------------
Option Explicit
'Place a Text Box and 3 Command Buttons on a form.
'This saves the text to the registry, an easy method for
'short strings as no file need be created.
Private Sub Command1_Click()
'Save text to registry.
SaveSetting App.EXEName, "MyString", "MyText", Text1.Text
End Sub
Private Sub Command2_Click()
'Read it back.
Text1.Text = GetSetting(App.EXEName, "MyString", "MyText", "")
End Sub
'I'm adding this command to cleanup the registry key where your text
'was stored, think of it in terms of deleteing the file that you no
'longer need after you've retrieved your text.
Private Sub Command3_Click()
DeleteSetting App.EXEName
End Sub
Private Sub Form_Load()
Command1.Caption = "Save"
Command2.Caption = "Read"
Command3.Caption = "Cleanup"
End Sub
'------------------------------------------------------------------------------------- -
Originally Posted by g_shocker182
Yeah, it takes a pro to make thing more complicated than they need be. Its an art form. LOL 8)A bird in the hand is worth a foot in the tush-Kelly Bundy
Similar Threads
-
Calling MediaInfo from Visual Basic to et video info
By SearchQuality in forum ProgrammingReplies: 18Last Post: 2nd Nov 2011, 06:36 -
Saving/capture solutions for saving off (extending) DVR
By ET3D in forum Newbie / General discussionsReplies: 1Last Post: 28th Oct 2011, 18:13 -
visual basic code
By kudoshinichi in forum ProgrammingReplies: 1Last Post: 21st Jan 2009, 08:30 -
Programming FFMPEG (Visual Basic)
By Ace-Of-Spades in forum ProgrammingReplies: 4Last Post: 9th Oct 2007, 06:18