Disini saya akan berbagi ilmu saya tentang
vs.net(VisualStudio.Net) yang saya terima dipraktikum hari jumat 13.30
Wib 9/4/10 diLab.
tulisan ini membahas tentang explorasi vs.net supaya kita lebih mengenal fitur-fiturnya dan mengetahui kemudahannya..
disini kita akan membuat dua buah form. form yang pertama memuat halaman
depan yang diberi nama hello dan form kedua diberi nama message. ikuti
langkah-langkahnya serta lihat gambar-gambarnya:
komponen gambar diatas:
Form1, MainMenu1, ToolTip1, ColorDialog1, Label1, Button1, Button2, Button3. Propertinya disesuakan sendiri.
dan bila dijalankan seperti ini gambarnya:
setelah itu buat form yang kedua.
komponen form diatas:
form2, MainMenu1, GroupBox1, Label1, Label2, TextBox1, RichTextbox1,GroupBox2,RadioButton1,RadioButton2,RadioButton3,
PictureBox1,Label3,Label4,CheckButton1,Button1,Button2
sebelum masuk ke script form1 dan form2 kita harus buat dulu modul
dengan cara. arahkan kursor keatas projek kuliah2 trus klik
kanan–>add–>add Module. dan isi dengan syntax seperti dibawah ini.
2 | Public
AppPath As String = Replace(Replace(Replace(Application.ExecutablePath,
Application.ProductName + ".EXE", ""), Application.ProductName +
".exe", ""), Application.ProductName + ".exe", "") |
dan untuk form1nya seperti dibawah ini.
02 | Inherits System.Windows.Forms.Form |
04 | Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click |
06 | If ColorDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then |
07 | Me.BackColor = ColorDialog1.Color |
08 | Dim sw As New System.IO.StreamWriter(AppPath & ("Setting2.txt")) |
09 | Dim a As String = Hex(ColorDialog1.Color.ToArgb) |
12 | sw.Close() 'Menutup file |
13 | System.IO.File.Delete(AppPath & ("Setting.txt")) |
14 | System.IO.File.Move(AppPath & ("Setting2.txt"), AppPath & ("Setting.txt")) |
22 | Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click |
27 | Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click |
28 | Dim message As New Form2 |
33 | Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click |
34 | Label1.Text = "pertemuan pertama" |
38 | Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load |
40 | If System.IO.File.Exists(AppPath & ("Setting.txt")) = False Then |
41 | Dim sw As New System.IO.StreamWriter(AppPath & ("Setting.txt")) |
42 | Dim c As System.Drawing.Color = System.Drawing.ColorTranslator.FromHtml("Control") |
43 | sw.WriteLine("#" & Hex(c.ToArgb)) |
47 | Dim sr As New System.IO.StreamReader(AppPath & ("Setting.txt")) |
50 | Dim color2 As System.Drawing.Color = System.Drawing.ColorTranslator.FromHtml(color) |
59 | Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click |
61 | Dim sw As New System.IO.StreamWriter(AppPath & ("Setting2.txt")) |
62 | Dim color2 As System.Drawing.Color = System.Drawing.ColorTranslator.FromHtml("Control") |
65 | sw.WriteLine("#" & Hex(color2.ToArgb)) |
67 | System.IO.File.Delete(AppPath & ("Setting.txt")) |
68 | System.IO.File.Move(AppPath & ("Setting2.txt"), AppPath & ("Setting.txt")) |
serta form2nya seperti dibawah ini
02 | Inherits System.Windows.Forms.Form |
04 | Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click |
05 | Form2.ActiveForm.Visible = False |
09 | Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click |
10 | Label4.Text = "dari : " & TextBox1.Text & " ,pesannya : " & RichTextBox1.Text |
14 | Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click |
17 | RichTextBox1.Text = " " |
21 | Private
Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox1.CheckedChanged |
22 | If CheckBox1.Checked = False Then |
25 | Label4.Visible = False |
30 | Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click |
31 | If PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage Then |
32 | PictureBox1.SizeMode = PictureBoxSizeMode.Normal |
33 | ElseIf PictureBox1.SizeMode = PictureBoxSizeMode.Normal Then |
34 | PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage |
38 | Private
Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles RadioButton1.CheckedChanged |
39 | Label4.ForeColor = Color.Red |
43 | Private
Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles RadioButton2.CheckedChanged |
44 | Label4.ForeColor = Color.Green |
48 | Private
Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles RadioButton3.CheckedChanged |
49 | Label4.ForeColor = Color.Black |
tampilan jadinya seperti ini:
Sumber : http://bahrie27.wordpress.com/2010/04/10/visual-studio-net/http://bahrie27.wordpress.com/2010/04/10/visual-studio-net/
Tidak ada komentar:
Posting Komentar