How to Add a Function in My.Settings in VB.Net

In this tutorial you will learn how to add a function in the My.Settings in VB.Net. This kind of method will give you an access to the application’s settings and it will enable you to store and retrieve property settings and any data that is needed in your application. Hope that you will find this tutorial useful and informative. Please follow the steps below; these are only simple and very easy to learn. Lets begin: Step 1. Open Microsoft Visual Studio 2015 and create new windows form application like shown below. ps1 Step 2. Add a Button in the Form. ps2 Step 3. Go to Project and select Properties. ps3 Step 4. In the project properties, select settings then hit the view code to fire the code editor. ps4 Step 5. Add the following code in the settings to store the data in the My.Settings, See it below.
  1. Partial Friend NotInheritable Class MySettings
  2.         Function MyName()
  3.             Return "Janno"
  4.         End Function
  5.     End Class
Step 6. After adding a function, go back to form1 and double click the button to fire the click event handler of it. Step 7. Do the following code in the sub routine to call the function in the My.Settings.
  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.         MsgBox("My Name is " & My.Settings.MyName)
  3.     End Sub
Press f5 to run this project. For any questions about this article. You can contact me @ Email – [email protected] Mobile No. – 09305235027 – TNT FB Account – https://www.facebook.com/onnaj.soicalap

Add new comment