Ok, I know this has been asked before but I'm a new user to VB and don't know where to start.

A Mate of mine is creating a Custom Minecraft Launcher useing VB for me.

We have 2 text boxes Username and Password and what I want it to do is On Closing the .exe to save the Contents of Username and Password to a .file, but for security perposes it needs to be encrypted before being exported to somewhere on the computer.

Can someone give me the code to encrypt 2 textboxes, where the Username is called txtUsername and the Password is called txtPassword.

It can be a very simple encryption, for example just switching the charactersets or something so an A = I
or something random unless anyone can think of a better way of encrypting.

IF someoen could write the code so I can copy and paste it, or if someone could point me in the right direction.

Thankyou in advance

Regards
Stealthbird97

use

My.Setting.'item name'

you dont need to seperate settings from your application

And where do i put this code

  Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
        CheckBox1.Checked = True

    End Sub


    Private Sub txtPassword_TextChanged(sender As Object, e As EventArgs) Handles txtPassword.TextChanged

    End Sub

    Private Sub txtUsername_TextChanged(sender As Object, e As EventArgs) Handles txtUsername.TextChanged

    End Sub

I want it to save the User and Pass when the Checkbox is true.

SaveSetting
first of all you should create your save's property
for this I've put a picture of how to do that
you can choose 'name' , 'type' , 'scope' and 'value'
select user scope so the value can be changed by code

now you can change it form your code : My.Settings.MyPropertyName

you can use a butoon to save your textboxes:

here we have two properties named "UserName" and "Password"

 Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
        My.Settings.UserName=txtUserName.text
        My.Settings.Password=txtPassword.text
        My.Settings.Save()
 End Sub
commented: Excellent Help +0

And then how do i get it to load when it starts up next time?

is this correct?

`

Private Sub Launcher_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ImageNum = 0
        txtUsername.text = My.Settings.Username
        txtPassword.text = My.Settings.Password
End Sub

`

Well that seems to work

Thankyou very much!

You can find the code here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.