Berikut coding nya :
Keterangan Interface
|
||
No.
|
Nama Komponen
|
Variabel Komponen
|
1
|
Label
|
lblLogin
|
2
|
Text Box
|
txtUser
|
3
|
Text Box
|
txtPW
|
4
|
Button
|
btnLogin
|
5
|
Label
|
lblPW
|
6
|
Label
|
lblUser
|
Nama Class
|
Nama Method
|
Source Code
|
Form 1
|
Login
|
private void btnLogin_Click(object sender, EventArgs
e)
{
if
(txtUser.Text == "SitiMuliaSari" && txtPW.Text == "pemvis5")
{
Form3 go = new Form3();
go.Show();
this.Visible = false;
}
else
MessageBox.Show("Nama atau Password salah ! ! !");
}
|
Form 3
|
Load
|
private void
Form3_Load(object sender, EventArgs e)
{
// TODO: This line of code loads
data into the 'database2DataSet1.DataPembeliPakaian' table. You can move, or
remove it, as needed.
this.dataPembeliPakaianTableAdapter.Fill(this.database2DataSet1.DataPembeliPakaian);
}
|
Exit
|
private void
btnExit_Click(object sender, EventArgs e)
{
DialogResult dr = MessageBox.Show("Anda
yakin ingin keluar ?", "Awas!", MessageBoxButtons.OKCancel); if
(dr == DialogResult.OK)
{
this.Close();
}
|
Class Form 1
|
|||||
Variable Komponen
|
Event
|
Source Code
|
|||
btnLogin
|
Click
|
private void btnLogin_Click(object sender, EventArgs
e)
{
if
(txtUser.Text == "SitiMuliaSari" && txtPW.Text == "pemvis5")
//untuk menampilkan user dan password
{
Form3 go = new
Form3();
go.Show(); //menampilkan form 3
this.Visible = false;
}
else
MessageBox.Show("Nama atau Password salah ! ! !"); //menampilkan
peringatan jika salah menginputkan
nama atau password
}
|
|||
Class Form 3
|
|||||
Nama Komponen
|
Event
|
Source Code
|
|||
btnExit
|
Click
|
private void
btnExit_Click(object sender, EventArgs e) {
DialogResult dr = MessageBox.Show("Anda yakin ingin keluar
?", "Awas!", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK)
//menampilkan peringatan jika ingin keluar
program { this.Close(); //keluar dari
program }
}
|
0 komentar:
Posting Komentar