SlideShare uma empresa Scribd logo
1 de 10
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.

Mais conteúdo relacionado

Semelhante a My.setting tutorial

Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docxLab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
smile790243
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
J. C.
 
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
niraj57
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
lorindajamieson
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
lhkslkdh89009
 
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
helpido9
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
AustinaGRPaigey
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure below
Tan Ps
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
gilbertkpeters11344
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls object
allenbailey
 

Semelhante a My.setting tutorial (20)

Creating an Uber Clone - Part XXXX - Transcript.pdf
Creating an Uber Clone - Part XXXX - Transcript.pdfCreating an Uber Clone - Part XXXX - Transcript.pdf
Creating an Uber Clone - Part XXXX - Transcript.pdf
 
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docxLab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
 
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
 
Linked In Presentation
Linked In PresentationLinked In Presentation
Linked In Presentation
 
Documentation For Tab Setup
Documentation For Tab SetupDocumentation For Tab Setup
Documentation For Tab Setup
 
LoginFormCode
LoginFormCodeLoginFormCode
LoginFormCode
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
 
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
 
Logical Triggers.pdf
Logical Triggers.pdfLogical Triggers.pdf
Logical Triggers.pdf
 
The visual studio start page is shown in the figure below
The visual studio start page is shown in the figure belowThe visual studio start page is shown in the figure below
The visual studio start page is shown in the figure below
 
Android Application Development - Level 2
Android Application Development - Level 2Android Application Development - Level 2
Android Application Development - Level 2
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
Android interface elements and controls-chapter8
Android interface elements and controls-chapter8Android interface elements and controls-chapter8
Android interface elements and controls-chapter8
 
Les22
Les22Les22
Les22
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls object
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 

Último

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Último (20)

Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 

My.setting tutorial

  • 2. ◦ 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.
  • 3.
  • 4.  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:
  • 5. 1. Right click on the name of your project, 2. Select ‘Properties’,
  • 6. 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.
  • 7.      @ 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.
  • 8.                  @ 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,
  • 9. 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
  • 10. I’ll check if I can upload the project.