I'm having some trouble with accessing variables on a button click (txtUsername and txtPassword). I'm not the greatest with vb, but here is my code if anyone can spot what i'm doing wrong...
VB.NET:
Public Class limelight
Public ds As Data.DataSet
Private Sub limelight_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mainPanel As New Panel
mainPanel.Parent = Me
mainPanel.Size = New Size(1024, 768)
mainPanel.Location = New Point(((Me.Width / 2) - (mainPanel.Width / 2)), ((Me.Height / 2) - (mainPanel.Height / 2)))
mainPanel.BorderStyle = BorderStyle.FixedSingle
mainPanel.BackColor = Color.Gainsboro
Dim loginpanel As New Panel
loginpanel.Parent = mainPanel
loginpanel.Size = New Size(500, 350)
loginpanel.Location = New Point(((mainPanel.Width / 2) - (loginpanel.Width / 2)), ((mainPanel.Height / 2) - (loginpanel.Height / 2)))
loginpanel.BorderStyle = BorderStyle.FixedSingle
Dim lblLoginTitle As New Label
lblLoginTitle.Parent = loginpanel
lblLoginTitle.Size = New Size(loginpanel.Width - 25, 50)
lblLoginTitle.Location = New Point(((loginpanel.Width / 2) - (lblLoginTitle.Width / 2)), 10)
lblLoginTitle.Text = "Login Required"
lblLoginTitle.Font = New Font("Arial", 20, FontStyle.Bold)
lblLoginTitle.TextAlign = ContentAlignment.MiddleCenter
lblLoginTitle.BackColor = Color.FromArgb(192, 255, 192)
Dim lblUsername As New Label
lblUsername.Parent = loginpanel
lblUsername.Size = New Size(150, 35)
lblUsername.Location = New Point(100, 125)
lblUsername.Text = "Username:"
lblUsername.Font = New Font("Arial", 16, FontStyle.Bold)
lblUsername.TextAlign = ContentAlignment.MiddleCenter
Dim txtUsername As New TextBox
txtUsername.Parent = loginpanel
txtUsername.Size = New Size(150, 50)
txtUsername.Location = New Point(250, 125)
txtUsername.Font = New Font("Arial", 16, FontStyle.Bold)
txtUsername.MaxLength = 8
Dim lblPassword As New Label
lblPassword.Parent = loginpanel
lblPassword.Size = New Size(150, 35)
lblPassword.Location = New Point(100, 175)
lblPassword.Text = "Password:"
lblPassword.Font = New Font("Arial", 16, FontStyle.Bold)
lblPassword.TextAlign = ContentAlignment.MiddleCenter
Dim txtPassword As New TextBox
txtPassword.Parent = loginpanel
txtPassword.PasswordChar = "*"
txtPassword.Size = New Size(150, 50)
txtPassword.Location = New Point(250, 175)
txtPassword.Font = New Font("Arial", 16, FontStyle.Bold)
txtPassword.MaxLength = 8
Dim btnLogin As New Button
btnLogin.Parent = loginpanel
btnLogin.Size = New Size(100, 50)
btnLogin.Location = New Point(((loginpanel.Width / 2) - (btnLogin.Width / 2)), 250)
btnLogin.Font = New Font("Arial", 16, FontStyle.Bold)
btnLogin.BackColor = Color.LightGray
btnLogin.FlatStyle = FlatStyle.Flat
btnLogin.Text = "Login"
End Sub
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim checkUser As New DatabaseDataSetTableAdapters.usersTableAdapter
Dim dt As Data.DataTable
dt = checkUser.GetUser(txtUsername.text, txtPassword.text)
End Sub
End Class