Me.Settings isn't a part of form1 - vb.net

me.settings isn't a part of form1
I have multiple forms, but my startup is my applications form not the login.
But here's my code for my login
Public Class Login
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = My.Settings.Username And TextBox2.Text = My.Settings.Password Then
MsgBox("Works!")
me.settings.Loggedin = true
Else
MsgBox("Missing Username or Password", MsgBoxStyle.Information, "Error")
End If
End Sub
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
CreateAccount.Show()
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class
I don't understand what the problem is.

The error message is informing you that the form called form1 does not have a property called Settings.
I believe you meant to say
My.Settings.Loggedin = true
instead of
me.settings.Loggedin = true

So you want the LOGIN FORM to be loaded first... then if the username and password are matching, then the APPLICATION FORM will be loaded?
If so, then you have to go to the project's properties and change the STARTUP FORM from your APPLICATION FORM's name into the LOGIN FORM's name.

Related

This Website Not login in Web Browser vb.net

I need code for web browser (vb.net) I want to login to a website in web browser but it's not logging in.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("https://freebitco.in/")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Username, Password As String
Username = "myemail#gmail.com"
Password = "my password"
' WebBrowser1.Document.GetElementById("fileupload").InvokeMember("click")
WebBrowser1.Document.GetElementById("btc_address").SetAttribute("value", Username)
WebBrowser1.Document.GetElementById("login_form_password").SetAttribute("value", Password)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Document.GetElementById("login_button").InvokeMember("click")
End Sub
Is not the first time here is talked abut this site (here another: Vb.Net web browser Not Working to Some Website same author but now deleted from this account) with similar question on WebBrowser.
Is bad habit to do advertising on StackOverflow.
Saying that:
Your code needs to be inside another event gesture which is:
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
AddHandler Button2.Click, Sub()
Dim Username, Password As String
Username = "myemail#gmail.com"
Password = "my password"
' WebBrowser1.Document.GetElementById("fileupload").InvokeMember("click")
WebBrowser1.Document.GetElementById("btc_address").SetAttribute("value", Username)
WebBrowser1.Document.GetElementById("login_form_password").SetAttribute("value", Password)
WebBrowser1.Document.GetElementById("login_button").InvokeMember("click")
End Sub
End Sub
Instead of your code.

how to make a vb program register form

How do i make a vb program register form? like you can in steam, google, Xbox live? Register on one computer and login from another Computer? For Free? Is i could like in drop box etc? I am making a game launcher program and i want to have theme sync there stuff. I Googled it no help! The only way i know how to is a offline account. It is annoying me. I am not that good in vb.net programming. Thanks!
here is my code
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Settings.sli Then
Main.show()
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
My.Settings.sli = 1
Else
My.Settings.sli = 0
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
My.Settings.user = TextBox3.Text
My.Settings.pass = TextBox4.Text
My.Settings.Save()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If My.Settings.user = TextBox1.Text And TextBox2.Text = My.Settings.pass Then
Main.Show()
Else
MsgBox("Username Or Password Wrong! Try Again!")
End If
End Sub
End Class
Thanks!

Reset My.Settings to values last saved

I'm currently using a "Settings" form to set various settings for my application. What I'm trying to do is to revert settings back to before any changes the user has made before opening and changing a field. I have a text box with a data binding to a setting and when I make a change and click okay it gets saved the next time I open it. When I hit cancel it also gets saved. Not quite sure if I'm approaching this correctly.
Public Class frmSettings
Private _mysettings As Configuration.SettingsBase
Private Sub frmSettings_Load(...) Handles Me.Load
_mysettings = My.Settings
End Sub
Private Sub btnCancel_Click(...) Handles btnCancel.Click
For Each p As Configuration.SettingsPropertyValue In _mysettings.PropertyValues
My.Settings(p.Name) = p.PropertyValue
Next
Me.Close()
End Sub
Private Sub btnOkay_Click(...) Handles btnOkay.Click
My.Settings.Save()
Me.Close()
End Sub
End Class
Rather than using databound control you can simply load the value of the setting when the settings form loads. It is simple doing it that way, and it works. Otherwise you would have to make a clone of My.Settings: doing _mysettings = My.Settings is only creating a pointer to My.Settings, not a copy of it.
For example, I have a Form named ChangeConnectionString which has OK/Cancel buttons and a TextBox control named connString:
Public Class ChangeConnectionString
Private Sub bnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnOK.Click
My.Settings.connectionString = connString.Text
My.Settings.Save()
Me.Close()
End Sub
Private Sub bnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnCancel.Click
Me.Close()
End Sub
Private Sub ChangeConnectionString_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
connString.Text = My.Settings.connectionString
End Sub
End Class

how to close all forms?

log.vb
Public Class log
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "bassam" And TextBox2.Text = "bassam" Then
Me.Hide()
msgbox1.Show()
Else
Me.Dispose()
End If
End Sub
End Class
msbox1.vb
Public Class msgbox1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
In the form msgbox1, I want to close the form log when i press Button1, but it just closes the msgbox1. How can I close all the forms?
If you want to close the whole application just call Application.Exit().

Open a webpage as soon as Webbrowser1 changes page?

I'm starting out coding and I've encountered a problem in the VB.NET application I'm creating.
When a new webpage is loaded in Webbrowser1 I want my code to open a link to execute in your own webbrowser, i.e chrome, Firefox.
How would I go about doing this?
Public Class Form1
Dim FirstRun As Boolean = True
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Navigate("http://stackoverflow.com")
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If Not FirstRun Then Process.Start("http://stackoverflow.com")
FirstRun = False
End Sub
End Class