• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
My.setting tutorial
 

My.setting tutorial

on

  • 164 views

my.setting

my.setting

Statistics

Views

Total Views
164
Views on SlideShare
164
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    My.setting tutorial My.setting tutorial Presentation Transcript

    • My.Setting
    • ◦ Introduction:  For student-developers out there, here is a tutorial about the My.Setting in vb.net.  Here is a simple Log-in form which will surely help you in your programs.
    •  Once you already have your forms with all the required textboxes, Labels, and buttons; see the ‘Solution Explorer’ mostly at the upper Right, then follow the images on the next slides:
    • 1. Right click on the name of your project, 2. Select ‘Properties’,
    • 3. Select Settings, 4. Fill-up the name and its value, Variables that will hold the username and password *note: Remember the Names and its corresponding Values, you will use it later.
    •      @ FORM LOAD: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles MyBase.Load lblUserName.Text = My.Settings.UN lblPassword.Text = My.Settings.PW The names we entered a while back. End Sub This code will call the values that you entered in the properties, In case you don’t remember the values, you can unhide the labels from their properties.
    •                  @ BUTTON LOGIN CLICKED: Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles btnLogIn.Click strInUN = txtUserName.Text strInPW = txtPassword.Text If strInUN = My.Settings.UN And strInPW = My.Settings.PW Then Me.Hide() Variables that will Form2.Show() hold the string txtPassword.Clear() value that you txtUserName.Clear() entered, Else MsgBox("User Name and Password mismatch", 0) txtPassword.Clear() txtUserName.Clear() End If Form2.txtNewPassword.Text = "New Password" Form2.txtNewUserName.Text = "New User Name" End Sub *note: Please Ensure that all variables are declared,
    • To check if the                            @ CHANGE ACCOUNT CLICKED: new password Private Sub btnChangeAccount_Click(ByVal sender As System.Object, ByVal e As _ and verify System.EventArgs) Handles btnChangeAccount.Click password strNewUN = txtNewUserName.Text matched, strNewPW = txtNewPassword.Text If txtNewPassword.Text = txtVerifyPassword.Text Then My.Settings.UN = txtNewUserName.Text My.Settings.PW = txtNewPassword.Text If strNewUN = "New User Name" Then MsgBox("Please enter your NEW User Name", 0) Setting the new ElseIf strNewPW = "New Password" Then username and MsgBox("Please enter your NEW Password", 0) password Else Me.Hide() Form1.Show() txtNewPassword.Clear() txtNewUserName.Clear() If the new txtVerifyPassword.Clear() password and the End If verification did Else not match, MsgBox("Password mismatched", 0) txtNewPassword.Clear() txtVerifyPassword.Clear() End If Form1.lblUserName.Text = My.Settings.UN To call the new Form1.lblPassword.Text = My.Settings.PW username and End Sub password at the first form
    • I’ll check if I can upload the project.