Rabu, 30 Maret 2011

List view untuk menampilkan data secara manual


buatlah design berikut :


nahh coding nyaa ikutin ajja yaa,, ga pake protes,, Ok ;

Public Class Form1

Dim isitext(4) As String 'var Array

Dim mylisitem As ListViewItem

Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated

Call bersih()

Call isi_combo()

Call Set_Tampilan()

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Sub bersih()

TextBox1.Text = ""

TextBox2.Text = ""

TextBox3.Text = ""

ComboBox1.Text = "06 Teknik Informatika"

End Sub

Sub isi_combo()

ComboBox1.Items.Add("06 Teknik Informatika")

ComboBox1.Items.Add("07 Sistem Informasi")

ComboBox1.Items.Add("67. Komputer Akuntansi")

ComboBox1.Items.Add("05 Teknik Komputer")

ComboBox1.Items.Add("26 Manajemen Informatika")

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If Button1.Text = "Tambah" Then

Button1.Text = "Simpan"

Button2.Enabled = False 'INI

Button3.Enabled = False 'INI

Button4.Text = "Batal"

TextBox1.Focus()

Else

'membuat array

isitext(0) = Trim(TextBox1.Text)

isitext(1) = Trim(TextBox2.Text)

isitext(2) = Trim(TextBox3.Text) 'UNTUK MENAMPILKAN SEMUA

isitext(3) = Microsoft.VisualBasic.Left(Trim(ComboBox1.Text), 2) 'mengambil 2 digit dari kiri dari kombobox

mylisitem = New ListViewItem(isitext) 'dipindahkan secara permanen

ListView1.Items.Add(mylisitem)

Call bersih()

TextBox1.Focus()

End If

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

If Button4.Text = "keluar" Then

Me.Close() 'FUNGSI UNTUK KELUAR DALAM FORM SENDIRI

Else

Call bersih()

Call normal()

End If

End Sub

Sub normal()

Button1.Text = "Tambah"

Button1.Enabled = True 'INI

Button2.Text = "Ubah"

Button2.Enabled = True 'INI

Button3.Text = "Hapus"

Button3.Enabled = True 'INI

Button4.Text = "keluar"

Button4.Enabled = True 'INI

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

If Button2.Text = "Ubah" Then

Button2.Text = "Simpan"

Button1.Enabled = False 'INi

Button3.Enabled = False 'INI

Button4.Text = "Batal"

TextBox1.Focus()

Else

End If

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

If Button3.Text = "Hapus" Then

Button3.Text = "Simpan"

Button1.Enabled = False 'INI

Button2.Enabled = False 'INI

Button4.Text = "Batal"

TextBox1.Focus()

Else

End If

End Sub

Sub Set_Tampilan()

ListView1.View = View.Details 'membentuk tampilan menjadi macam2

'membuat kolom : ( nama kolom, lebar kolom, posisi tulisan)

ListView1.Columns.Add("NPM", 100, HorizontalAlignment.Center)

ListView1.Columns.Add("Nama", 100, HorizontalAlignment.Center)

ListView1.Columns.Add("Alamat", 100, HorizontalAlignment.Center)

ListView1.Columns.Add("Jurusan", 100, HorizontalAlignment.Center)

End Sub

Private Sub ListView1_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles ListView1.ItemSelectionChanged

TextBox1.Text = e.Item.Text 'INI --> e

End Sub

End Class






klo di running jadinya gini :


Membuat tampilan Puzzle di VB.net 2008

thank's before buat Temen saya ini, cz saya copy dari blog dia,, pinjem bentar ya prenn,, buat ujian..
buat dulu design kaya gini :



Lalu ubah "Nama" Button 1 menjadi "3" dengan merubah pada propertiesnya :

Lakukan Hal yang sama untuk Button Lain, Seperti Berikut :
button2 textnya menjadi =5
button3 textnya menjadi =6
button4 textnya menjadi =2
button5 textnya menjadi =1
button6 textnya menjadi =7
button7 textnya menjadi =8
button8 textnya menjadi =4
sedangkan button9
button9 menjadi visible = false *,seperti:


kemudian, masukkan coding berikut & sesuaikan dengan button awal (nomor yang normal ):
Public Class Form1

(button1):
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button2.Visible = False Then
Button2.Visible = True
Button1.Visible = False
Button2.Text = Button1.Text

Else
If Button4.Visible = False Then
Button4.Visible = True
Button1.Visible = False
Button4.Text = Button1.Text
End If
End If

kerja()
End Sub

(button2):

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Button1.Visible = False Then
Button1.Visible = True
Button2.Visible = False
Button1.Text = Button2.Text

ElseIf Button3.Visible = False Then
Button3.Visible = True
Button2.Visible = False
Button3.Text = Button2.Text

ElseIf Button5.Visible = False Then
Button2.Visible = True
Button5.Visible = False
Button5.Text = Button2.Text

End If

kerja()
End Sub

(button3):

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If Button2.Visible = False Then
Button2.Visible = True
Button3.Visible = False
Button2.Text = Button3.Text
Else
If Button6.Visible = False Then
Button6.Visible = True
Button3.Visible = False
Button6.Text = Button3.Text
End If

End If


End Sub

(button4):

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If Button1.Visible = False Then
Button1.Visible = True
Button4.Visible = False
Button1.Text = Button4.Text
ElseIf Button5.Visible = False Then
Button5.Visible = True
Button4.Visible = False
Button5.Text = Button4.Text
ElseIf Button7.Visible = False Then
Button7.Visible = True
Button4.Visible = False
Button7.Text = Button4.Text
End If
kerja()
End Sub

(button5):

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If Button2.Visible = False Then
Button2.Visible = True
Button5.Visible = False
Button2.Text = Button5.Text
ElseIf Button4.Visible = False Then
Button4.Visible = True
Button5.Visible = False
Button4.Text = Button5.Text
ElseIf Button6.Visible = False Then
Button6.Visible = True
Button5.Visible = False
Button6.Text = Button5.Text
ElseIf Button8.Visible = False Then
Button8.Visible = True
Button5.Visible = False
Button8.Text = Button5.Text
End If

kerja()
End Sub

(button6):

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If Button3.Visible = False Then
Button3.Visible = True
Button6.Visible = False
Button3.Text = Button6.Text
ElseIf Button9.Visible = False Then
Button9.Visible = True
Button6.Visible = False
Button9.Text = Button6.Text
ElseIf Button5.Visible = False Then
Button5.Visible = True
Button6.Visible = False
Button5.Text = Button6.Text
End If
kerja()
End Sub

(button7):

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If Button8.Visible = False Then
Button8.Visible = True
Button7.Visible = False
Button8.Text = Button7.Text
Else
If Button4.Visible = False Then
Button4.Visible = True
Button7.Visible = False
Button4.Text = Button7.Text
End If
End If
kerja()
End Sub

(button8):

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If Button7.Visible = False Then
Button7.Visible = True
Button8.Visible = False
Button7.Text = Button8.Text
ElseIf Button9.Visible = False Then
Button9.Visible = True
Button8.Visible = False
Button9.Text = Button8.Text
ElseIf Button5.Visible = False Then
Button5.Visible = True
Button8.Visible = False
Button5.Text = Button8.Text
End If
kerja()
End Sub

(button9):

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If Button6.Visible = False Then
Button6.Visible = True
Button9.Visible = False
Button6.Text = Button9.Text
Else
If Button8.Visible = False Then
Button8.Visible = True
Button9.Visible = False
Button8.Text = Button9.Text
End If
End If
kerja()
End Sub

setelah selesai mengisi printah dari setiap button tersebut sekarang kita tambah methotnya :
Private Sub kerja()
If (Button1.Text = "1" And Button2.Text = "2" And Button3.Text = "3" And Button4.Text = "4") Then
If (Button5.Text = "5" And Button6.Text = "6" And Button7.Text = "7") Then
If (Button8.Text = "8") Then

MessageBox.Show(" selamat anda berhasil")
End If
End If
End If
End Sub
End Class

Tinggal di Running Deh... F5 atao De
bugging,,,,

nnti button2 tersebut bisa dipindah2in kaya main puzzle..





Met UJIAN YAAA>>>> *_^



Kamis, 10 Maret 2011

Looping di VB.net 2008

Kali ini,, qt belajar looping yaaa,, hmmm.. lagi2 kesalahan jaringan internetnya,, jadi aku ga bs upload gambar untuk artikelnya nih,,, mohon maaf,, yaa,, sementara untuk malihat file nya silahkan download disini gratis kok... n klo koneksi dah lancar,, aq pasti upload artikelnya..
MOhon Maaaf AtasKetidaknyamananya yaaa piissss ,,,,=)

Review pertemuan 4 VB . Net 2008

Postingan ini memuattentang bagaimana kita membuat program loping , memakai fasilitas Combo box , karena terjadi kesalahan koneksi, karena aq tdk dpt meng-upload foto untuk artikel ini... maka aku simpan di sinii ..... untuk melihatnya silahkan men-Download.. nya Its Freee..

Senin, 07 Maret 2011

Belajar membuat LIST BOX di VB.net 2008

Belajar yukk,,,

namanya juga belajar,, jadi bila terdapat kesalahan dalam penulisan ini, mohon untuk bantuanyaa yaaa…=) .. kali ini kita akan membahas tentang List Box..

List box memiliki fungsi untuk menampilkan beberapa daftar pilihan. Kita tinggal memilih pilihan yang ada, atau list box juga dapat di gunakan untuk menampung data-data yang di input, untuk kemudian kita dapat gabungkan pada list box.

Tampilan list box :


Pembahasan kali ini, kita akan coba membuat program untuk menggabungkan data yang kita input, lalu akan kita gabungkan , dan akan ditampilkan melalui listbox…

Perintah sederhananya : ListBox1.Items.Add(TextBox.Text + " " + TextBox……..)

Pertama,,, buat form windows seperti tampilan di atas, lalu buat coding seperti dibawah ini :

Sub pros3()
ListBox1.Items.Add(TextBox3.Text + " " + TextBox4.Text + " " + TextBox5.Text + " " _
+ TextBox6.Text + " " + TextBox7.Text)
End Sub
Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress
If e.KeyChar = Chr(13) Then
TextBox4.Focus()
End If
End Sub
Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If e.KeyChar = Chr(13) Then
TextBox5.Focus()
End If
End Sub
Private Sub TextBox5_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox5.KeyPress
If e.KeyChar = Chr(13) Then
TextBox6.Focus()
End If
End Sub
Private Sub TextBox6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress
If e.KeyChar = Chr(13) Then
TextBox7.Focus()
End If
End Sub

Private Sub TextBox7_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox7.KeyPress
If e.KeyChar = Chr(13) Then
Call pros3()
Call bersihpros()
TextBox3.Focus()
End If
End Sub
Sub bersihpros()
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
End Sub
End Class


Lalu jalankan denga F5, isi kata untuk data 1 diakhiri dengan Enter, hingga data 7 :

Maka kumpulan kata-kata yang di input tadi akan tergabung di dalam List Box