Skip to main content
Search
Search This Blog
Vbfeed4
Home
More…
Share
Get link
Facebook
X
Pinterest
Email
Other Apps
Labels
Visual Basic.Net
June 11, 2017
Strutur Dan Array dalam Visual Basic .Net
Public Class Form1 Private Structure Data_mahasiswa Dim Nik As Integer Dim Nama As String Dim Jenis_kelamin As String Dim Jurusan As String End Structure Dim Arr() As Data_mahasiswa Dim indeks As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load indeks = 1 ReDim Arr(indeks) TxtNik.Text = indeks Dim ArrMulti(4, 1) As String ArrMulti(0, 0) = "Nik" ArrMulti(0, 1) = "Nama" ArrMulti(1, 0) = "Jenis Kelamin" ArrMulti(1, 1) = "Jurusan" ArrMulti(2, 0) = "Laki - laki" ArrMulti(2, 1) = "Perempuan" ArrMulti(3, 0) = "Manajemen Informatika" ArrMulti(3, 1) = "Komputerisasi Akuntansi" ArrMulti(4, 0) = "Sistem Informasi" ArrMulti(4, 1) = "Teknik Informatika" ListView1.GridLines = True ListView1.View = View.Details For Baris = 0 To 1 For kolom = 0 To 1 ListView1.Columns.Add(ArrMulti(Baris, kolom), 100) Next kolom Next Baris For Baris = 2 To 2 For kolom = 0 To 1 CmbKelamin.Items.Add(ArrMulti(Baris, kolom)) Next kolom Next Baris For Baris = 3 To 4 For kolom = 0 To 1 CmbJurusan.Items.Add(ArrMulti(Baris, kolom)) Next kolom Next Baris End Sub Private Sub BtnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSimpan.Click Arr(indeks).Nama = TxtNama.Text Arr(indeks).Jenis_kelamin = CmbKelamin.Text Arr(indeks).Jurusan = CmbJurusan.Text TxtNik.Text = indeks If indeks = UBound(Arr) Then ReDim Preserve Arr(indeks + 1) End If Dim listitem As ListViewItem listitem = New ListViewItem listitem = ListView1.Items.Add(TxtNik.Text) listitem.SubItems.Add(TxtNama.Text) listitem.SubItems.Add(CmbKelamin.Text) listitem.SubItems.Add(CmbJurusan.Text) indeks = indeks + 1 TxtNik.Text = indeks TxtNama.Text = "" CmbJurusan.Text = "" CmbKelamin.Text = "" TxtNama.Focus() End Sub Private Sub BtnCari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCari.Click Dim cari As String cari = InputBox("Masukkan nik mahasiswa !") If cari = "" Then Exit Sub indeks = cari TxtNama.Text = Arr(indeks).Nama CmbKelamin.Text = Arr(indeks).Jenis_kelamin CmbJurusan.Text = Arr(indeks).Jurusan TxtNik.Text = indeks End Sub Private Sub BtnMundur_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMundur.Click indeks = TxtNik.Text - 1 TxtNama.Text = Arr(indeks).Nama CmbKelamin.Text = Arr(indeks).Jenis_kelamin CmbJurusan.Text = Arr(indeks).Jurusan TxtNik.Text = indeks End Sub Private Sub BtnMaju_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMaju.Click indeks = TxtNik.Text + 1 TxtNama.Text = Arr(indeks).Nama CmbKelamin.Text = Arr(indeks).Jenis_kelamin CmbJurusan.Text = Arr(indeks).Jurusan TxtNik.Text = indeks End Sub End Class
Comments
Popular Posts
January 28, 2017
Pengenalan, Sejarah, dan Perkembangan aplikasi Adobe Illustrator
May 07, 2013
Apakah saya dapat menggunakan lebih dari satu domain dalam satu akun hosting?
Comments
Post a Comment