VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. 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
    Quote Quote  
  2. Member DVO's Avatar
    Join Date
    Apr 2002
    Location
    Sweden
    Search Comp PM
    Idea for workaround:
    Have the program read a text file each time it starts and save the input in that file.
    Quote Quote  
  3. dea for workaround:
    Have the program read a text file each time it starts and save the input in that file.
    Translate into VB code, thank you.
    Quote Quote  
  4. Member DVO's Avatar
    Join Date
    Apr 2002
    Location
    Sweden
    Search Comp PM
    Sorry, I don't know VB I only know C++.
    Quote Quote  
  5. Member DVO's Avatar
    Join Date
    Apr 2002
    Location
    Sweden
    Search Comp PM
    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
    Quote Quote  
  6. Anyways,

    Originally Posted by g_shocker182
    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
    Quote Quote  
  7. 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 = strtext
    A bird in the hand is worth a foot in the tush-Kelly Bundy
    Quote Quote  
  8. Member
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Search Comp PM
    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.
    Quote Quote  
  9. Member JustJay's Avatar
    Join Date
    Feb 2003
    Location
    Virginia, USA
    Search Comp PM
    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.
    Quote Quote  
  10. 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.
    Quote Quote  
  11. 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
    Quote Quote  
  12. Member
    Join Date
    Mar 2003
    Location
    Uranus
    Search Comp PM
    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)
    Quote Quote  
  13. Given:

    MSDN = 1 GB
    MY HD = 20GB; Free Space = 11GB

    ,

    MSDN = No can do.
    Quote Quote  
  14. 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).
    Quote Quote  
  15. Member JustJay's Avatar
    Join Date
    Feb 2003
    Location
    Virginia, USA
    Search Comp PM
    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
    '-------------------------------------------------------------------------------------
    Quote Quote  
  16. Finally a professional programmer....


    thanks
    Quote Quote  
  17. Originally Posted by g_shocker182
    Finally a professional programmer....


    thanks

    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
    Quote Quote  



Similar Threads