Results 1 to 9 of 9

Thread: [RESOLVED] [2005] A Weird doubt with TextBox Control

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    40

    Resolved [RESOLVED] [2005] A Weird doubt with TextBox Control

    hi frens..
    i am using a username and password textboxes on a form.
    i just want to input username and password only once in those text boxes
    after that how many ever times i run the project the same username
    and password should be used.
    if i want to change that username and password i gave for the 1st time
    then i can use a button or any other control.

    this should happen even after i publish the project as exe file and distribute
    to my team members.

    P.S:
    my intention is to distribute this form as a exe file to my team members.
    and i wish my team members may not type the username and password
    everyday and everytime if they wish to run my exe file.


    Can this happen with vs2005 text box component ?

  2. #2
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] A Weird doubt with TextBox Control

    Check out My.Settings in 2005.

    You can save that information and use it. Then if you want to change the details, chage the variable in settings and save them.
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    40

    Re: [2005] A Weird doubt with TextBox Control

    dear friend stimbo...
    can u help me do it ?

  4. #4
    Frenzied Member stimbo's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    1,739

    Re: [2005] A Weird doubt with TextBox Control

    If you check out on the taskbar: Project -> Properties -> Settings (Panel)

    You will then be able to create variables there with values. You can create 2 string variables, one for username and one for password, including values.

    In the form Load you can input the variables like this:

    vb Code:
    1. Me.UserNameBox.Text = My.Settings.userName
    Stim

    Free VB.NET Book Chapter
    Visual Basic 2005 Cookbook Sample Chapter

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    40

    Re: [2005] A Weird doubt with TextBox Control

    thanks stimbo...
    but my intention is different from this one.
    according to ur suggestion
    the username and password always remains the same as wat i m goin to
    give in value field of settings section.

    but my intention is
    when the exe file was run for the first time
    it wil prompt for username and password.
    after typing it and running.. the application wil never
    prompt for username and password anymore.
    but in case by chance if the user wish to input a different
    username and different password after running the exe 10 or 20 or so many times then i have to supply a different control that helps the user to input
    the new username and password.. and thereafter the newly inputted credentials will be used forever till the user again wishes to change it.


    the explanation is very simple..
    its like locking the textboxes with the user specified values.
    and if needed unlocking it for new values and again locking it.

    can this be possible ?

  6. #6
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: [2005] A Weird doubt with TextBox Control

    the use of my.settings is that it stores the default value that you want for your application. When the application is executed, you can check for the existence of the attributes userName and password, if there are not there, then it is the first time and you prompt for a username and password and save the info in the my.settings.
    Whenever you want to change those values, just
    vb Code:
    1. my.settings.username = textbox1.text

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    40

    Re: [2005] A Weird doubt with TextBox Control

    i tried it friend.
    it shows the value i gave in my settings.
    but how to bring the value from the text box to this settings value field
    during run time ?

  8. #8
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] A Weird doubt with TextBox Control

    This is a horible method for saving the username and password because it is stored in plain text. That means that anyone can access the username and password simply by opening the user.config file. Is security a concern in your app?
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  9. #9

    Thread Starter
    Member
    Join Date
    Feb 2007
    Posts
    40

    Re: [2005] A Weird doubt with TextBox Control

    no it isnt... security isnt a big deal of concern for me..
    coz i am just giving this app to my team mates.

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