Nothing Special   »   [go: up one dir, main page]

Listing: Using Using Using Using Using Using Using Using Namespace Public Partial Class Public

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Listing

using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;

namespace Tugas
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void buttonX1_Click(object sender, EventArgs e)
{
string a;
if (radioButton1.Checked == true)
{
a = "Laki - Laki";
}
else
{
a = "Perempuan";
}
if (textBoxX3.Text != textBoxX2.Text)
{
MessageBox.Show("Password dan Re-Password tidak sama");
textBoxX3.Focus();
return;
}
Form2 tampil = new Form2("Nama : " + textBoxX1.Text + System.Environment.NewLine
+ "Password : "
+ textBoxX2.Text + System.Environment.NewLine + "Re-Password : " + textBoxX3.Text
+ System.Environment.NewLine
+ "Tanggal Lahir : " + comboBoxEx1.SelectedItem + "-" + comboBoxEx2.SelectedItem
+ " - " + comboBoxEx3.SelectedItem
+ System.Environment.NewLine + "Jenis Kelamin : " + a +
System.Environment.NewLine + "Telepon : "
+ textBoxX4.Text + System.Environment.NewLine + "Hint Password : " +
textBoxX5.Text+System.Environment.NewLine
+"Tipe Karakter : "+listBox1.SelectedItem);
tampil.Show();
this.Hide();
}
private void buttonX3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void buttonX2_Click(object sender, EventArgs e)
{
textBoxX1.Text = "";

textBoxX2.Text = "";
textBoxX3.Text = "";
comboBoxEx1.SelectedItem = "";
comboBoxEx2.SelectedItem = "";
comboBoxEx3.SelectedItem = "";
textBoxX4.Text = "";
textBoxX5.Text = "";

private void textBoxX5_KeyPress(object sender, KeyPressEventArgs e)


{
char ch = e.KeyChar;
if (!Char.IsDigit(ch) && ch != 8)
{
e.Handled = true;
}
}
private void textBoxX4_KeyPress(object sender, KeyPressEventArgs e)
{
char ch = e.KeyChar;
if (!Char.IsDigit(ch) && ch != 8)
{
e.Handled = true;
}
}
private void textBoxX5_Validating_1(object sender, CancelEventArgs e)
{
if (textBoxX5.Text == "")
{
e.Cancel = true;
}
}
private void textBoxX1_Validating_1(object sender, CancelEventArgs e)
{
if (textBoxX1.Text == "")
{
e.Cancel = true;
}
}

}
}

private void textBoxX2_Validating_1(object sender, CancelEventArgs e)


{
if (textBoxX2.Text == "")
{
e.Cancel = true;
}
}

using
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;

namespace Tugas
{
public partial class Form2 : Form
{
string datapassing;
public Form2(string data)
{
InitializeComponent();
this.datapassing = data;
}
private void Form2_Load(object sender, EventArgs e)
{
textBox1.Text = datapassing;
Form1 tampil = new Form1();
}
private void buttonX1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void buttonX2_Click(object sender, EventArgs e)
{
Form1 tampil = new Form1();
tampil.Show();
this.Hide();
}

Hasil Output

You might also like