Results 1 to 10 of 10

Thread: save data textboxes

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Location
    friesland (Netherlands)
    Posts
    79

    save data textboxes

    dear forum users

    i am making a program with multiple textboxes (60). the user needs to fill in all the 60 textboxes and i want to save them so the user doesn't need to fill in all the 60 textboxes everytime he starts the program.
    my idea is to make a combolist so the user can select his own 60 boxes after he filled it once and saved it

    i hope my question is pretty clear
    greeting Pieter

  2. #2
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: save data textboxes

    It would depend on some other things, but if the issue is that the contents of the textboxes must persist between sessions, you may look into Settings. Of course, creating 60 settings and then populating them is a bit of a lot of work, but you would not need to manage any files directly on disk. This will persist from session to session but only for each specific windows user.

    To create the settings go Project - Project Properties - Settings And put them one by one: name(Your desired name, in this example: String01, String02, String03, ...), Type (String), Scope (User), no need to put a Value here.

    Then on your code you will do this everytime the form is opened:

    vb.net Code:
    1. With My.Settings
    2.     TextBox1.Text = .String01
    3.     TextBox2.Text = .String02
    4.     TextBox3.Text = .String03
    5.     TextBox4.Text = .String04
    6. End With

    At the end, when you are exiting the form do the oposite:

    vb.net Code:
    1. With My.Settings
    2.     .String01 = TextBox1.Text = .String01
    3.     .String02 = TextBox2.Text = .String01
    4.     .String03 = TextBox3.Text = .String01
    5.     .String04 = TextBox4.Text = .String01
    6. End With
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

  3. #3
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: save data textboxes

    If all that is required is to save the textbox value and reload on startup then this requires no code. Property bind it.

    Select Control - Properties -Application Settings - Propertie Bind - (...) - Text - New - Name

    then we are done.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Location
    friesland (Netherlands)
    Posts
    79

    Re: save data textboxes

    wow thanks for the fast reply!
    the my.settings works for me but now i want to make it nice for the user.
    so i need to make "folders" with textbox set1, textbox set 2, ect
    so the user only needs to select the textboxset and it will be filled in automaticly. is there a way to that?
    i prefer data source binder ect because i didn't used that and i like to know it a little bit better

    i am going to try ident his idea now


    edit: i dont even know what you mean with control :'(
    i feel stupid XD
    your idea sound very simple so can you help me with that?

  5. #5
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: save data textboxes

    The textbox will be filled at startup like i said. A textbox is a control. Select the textbox and properties then follow the steps i laid out. You dont need to make any folder.

  6. #6
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: save data textboxes

    What ident sugested is a variation of what I said, it also uses My.Settings. With two improvements: 1st you can create the settings while assigning them, and you only need to do it once in the UI. 2nd, no need to put code to keep the textbox (contro) linked to the settings.

    What Ident means by "control" is that you need to select the textBox, then go to the properties window, search for Application Settings (usually the first one), click on it to expand and select PropertyBinding, then click on the (...), on the window that appears, select Text, inside it select "New", and give the property a name.

    Since you would need to do this for each one of the 60 textBoxes I suggest you create one and then make copies, it will be much easier to change the name of the setting than to have to do all those steps.
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Location
    friesland (Netherlands)
    Posts
    79

    Re: save data textboxes

    aha now i understand sorry i am very new in programming
    but that is not exectly what i wanted, now it goes further were you ended right?
    i want to let them fill in 60 textboxes and than let them have the option to save the textboxes to that string01 but if they start the app the next time they can make anotherone. so they can make there own data base with there own textbox sets.
    thanks for the reply

    for example:
    if textboxset1 is selected
    textbox1.text = hello
    if textboxset2 is selected
    textbox1.text = goodbye
    Last edited by spiedey; Mar 19th, 2012 at 06:02 PM.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Location
    friesland (Netherlands)
    Posts
    79

    Re: save data textboxes

    is that possible?

  9. #9
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: save data textboxes

    So what you are asking for is difference profile settings? 60 textboxes saved each time or reloaded depending on what profile the user is asking for.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    May 2009
    Location
    friesland (Netherlands)
    Posts
    79

    Re: save data textboxes

    exectly
    sorry if i am very unclear

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width