CODING DATA DIRI & FOTO
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace latihanShowDataDiri
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void button1_Click(object
sender, EventArgs e)
{
DialogResult
dr = openFileDialog1.ShowDialog();
if
(dr == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
Form2
d = new Form2();
d.pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
}
else
{
pictureBox1.Image = Image.FromFile(null);
}
private
void Form1_Load(object
sender, EventArgs e)
{
cmbAgama.Items.Add("Islam");
cmbAgama.Items.Add("Khatolik");
cmbAgama.Items.Add("Protestan");
cmbAgama.Items.Add("Hindu");
cmbAgama.Items.Add("Budha");
}
private
void button2_Click(object
sender, EventArgs e)
{
string
a, b, c, d, f;
if
(optLakilaki.Checked == true)
{
a = "Laki-laki";
}
else
{
a = "Perempuan";
}
if
(checkBox1.Checked == true)
{
b = "Membaca
";
}
else
{
b = "";
}
if
(checkBox2.Checked == true)
{
c = "Bersepeda
";
}
else
{
c = "";
}
if
(checkBox3.Checked == true)
{
d = "Menyanyi
";
}
else
{
d = "";
}
if
(checkBox4.Checked == true)
{
f = "Game
Online ";
}
else
{
f = "";
}
Form2
baru = new Form2();
baru.pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
baru.richTextBox1.Text = "Nama\t\t:" + txtNama.Text + "\nAlamat\t\t: " + txtAlamat.Text
+ "\nAgama\t\t:
" + cmbAgama.SelectedItem + "\nJenis
Kelamin\t: " + a +
"\nHobi\t\t:
" + b + c + d +f;
baru.Show();
}
}
}




Comments