login, username, password, service based database, dr.girija, dr.girija narasimhan, vb.net, visual studio 2012, if .. then, DialogResult,bindingsource.filter
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Part 25 login both admin and user using service based database
1. Visual BASIC .NET 2012
PART 25-login both admin, user
using
service based database
Dr. GIRIJA NARASIMHAN 1
This slides are available http://slideshare.net /nbgirija
2. Dr. GIRIJA NARASIMHAN 2
This tutorial only for beginners , those
who don’t have any knowledge about
any programming language skill and
application design.
3. Dr.GIRIJA NARASIMHAN 3
public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database1DataSet.login' table. You can
move, or remove it, as needed.
Me.LoginTableAdapter.Fill(Me.Database1DataSet.login)
ComboBox1.Items.Add("admin")
ComboBox1.Items.Add("user")
UsernameTextBox.Visible = False
PasswordTextBox.Visible = False
UtypeComboBox.Visible = False
Me.LoginBindingNavigator.Visible = False
End Sub
4. Dr.GIRIJA NARASIMHAN 4
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim RE As DialogResult
RE = Windows.Forms.DialogResult.Yes
If RE = Windows.Forms.DialogResult.Yes Then
If UCase(TextBox1.Text) = UCase(UsernameTextBox.Text) And UCase(TextBox2.Text) =
UCase(PasswordTextBox.Text) And ComboBox1.Text = UtypeComboBox.Text Then
MessageBox.Show("LOGIN SUCCESS", "SUCCESS", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation)
Else
MessageBox.Show("INCORRECT LOGIN", "INCORRECT", MessageBoxButtons.OK,
MessageBoxIcon.Error)
RE = MessageBox.Show("DO YOU WISH TO TRY AGAIN", "TRY LOGIN",
MessageBoxButtons.YesNo)
If RE = Windows.Forms.DialogResult.Yes Then
TextBox1.Clear()
TextBox2.Clear()
Else
Me.Close()
End If
End If
End If
End Sub
5. Dr.GIRIJA NARASIMHAN 5
Private Sub LoginBindingNavigatorSaveItem_Click(sender As Object, e As
EventArgs) Handles LoginBindingNavigatorSaveItem.Click
Me.Validate()
Me.LoginBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Database1DataSet)
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles
TextBox1.TextChanged
LoginBindingSource.Filter = "username like'" & TextBox1.Text & "*' "
End Sub
End Class