Membuat Game TTS (Teka Teki Silang) Menggunakan Visual Basic 2008/VB.net


Untuk Membuat Game TTS (Teka Teki Silang) Menggunakan Visual Basic 2008/VB.net anda harus mengerti terlebih dahulu jawaban dari pertanyaan yang akan anda buat dan mampu menghitung jumlah huruf dari setiap jawaban dari pertanyaan yang dibuat tersbut, kemudian harus bisa menggabungkan 2 jawaban atau lebih menjadi satu rangkaian kata dengan metode mendatar dan menurun.


Membuat Game TTS (Teka Teki Silang) Menggunakan Visual Basic 2008/VB.net susah-susah mudah sebenarnya, karena harus benar-benar jeli dan tau betul rancangan If & Then.
Karena rancangan If & Then ini tidak seperti If & Then sederhana yang hanya menggunakan 1 Alasan saja akan tetapi logika awalnya seperti ini Jika textbox1.text=A atau textbox1.text=a dan textboxt2.text=B atau textbox2.text=b maka label1.text=benar.
Baiklah untuk mempersingkat waktu dan tempat juga penulisan maka saya akan memulai pembuatan Game TTS ini, buatlah satu form dengan komponen:
  • 32 Textbox
  • 5 Label
  • 1 Picturebox
 Lihat gambar dibawah ini dan buatlah agar persis seperti gambar dibawah ini:


Selanjutnya klik 2 kali formnya, hapus semua kode yang sudah ada dan masukkan kode dibawah ini:
Public Class Form1

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Enabled = False
    End Sub

    Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
        TextBox2.Enabled = False
        If (TextBox1.Text = "a" Or TextBox1.Text = "A") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
            Label3.Text += 1
        ElseIf (TextBox1.Text = "" Or TextBox1.Text = "") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
            Label3.Text = Label3.Text
        ElseIf (TextBox1.Text = "" Or TextBox1.Text = "") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "" Or TextBox3.Text = "") Then
            Label3.Text = Label3.Text
        ElseIf (TextBox1.Text = "a" Or TextBox1.Text = "A") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "" Or TextBox3.Text = "") Then
            Label3.Text = Label3.Text
        Else
            Label4.Text += 1
        End If
    End Sub

    Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
        TextBox3.Enabled = False
        If (TextBox1.Text = "a" Or TextBox1.Text = "A") And (TextBox2.Text = "k" Or TextBox2.Text = "K") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
            Label3.Text += 1
        ElseIf (TextBox1.Text = "" Or TextBox1.Text = "") And (TextBox2.Text = "" Or TextBox2.Text = "") And (TextBox3.Text = "u" Or TextBox3.Text = "U") Then
            Label3.Text = Label3.Text
        Else
            Label4.Text += 1
        End If
    End Sub

    Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
        TextBox4.Enabled = False
    End Sub

    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
        TextBox5.Enabled = False
    End Sub

    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
        TextBox6.Enabled = False
        If (TextBox4.Text = "l" Or TextBox4.Text = "L") And (TextBox5.Text = "a" Or TextBox5.Text = "A") And (TextBox6.Text = "r" Or TextBox6.Text = "R") Then
            Label3.Text += 1
        Else
            Label4.Text += 1
        End If
    End Sub


    Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
        TextBox7.Enabled = False
    End Sub

    Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
        TextBox8.Enabled = False
    End Sub

    Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox9.TextChanged
        TextBox9.Enabled = False
    End Sub

    Private Sub TextBox10_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox10.TextChanged
        TextBox10.Enabled = False
        If (TextBox7.Text = "a" Or TextBox7.Text = "A") And (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox9.Text = "g" Or TextBox9.Text = "G") And (TextBox10.Text = "e" Or TextBox10.Text = "E") Then
            Label3.Text += 1
        Else
            Label4.Text += 1
        End If
    End Sub

    Private Sub TextBox11_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox11.TextChanged
        TextBox11.Enabled = False
    End Sub

    Private Sub TextBox12_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox12.TextChanged
        TextBox12.Enabled = False
    End Sub

    Private Sub TextBox13_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox13.TextChanged
        TextBox13.Enabled = False
        If (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "o" Or TextBox11.Text = "O") And (TextBox12.Text = "b" Or TextBox12.Text = "B") And (TextBox13.Text = "o" Or TextBox13.Text = "O") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
            Label3.Text += 1
        ElseIf (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
            Label3.Text = Label3.Text
        ElseIf (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "o" Or TextBox11.Text = "O") And (TextBox12.Text = "b" Or TextBox12.Text = "B") And (TextBox13.Text = "o" Or TextBox13.Text = "O") And (TextBox14.Text = "" Or TextBox14.Text = "") Then
            Label3.Text = Label3.Text
        ElseIf (TextBox8.Text = "" Or TextBox8.Text = "") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
            Label3.Text = Label3.Text
        Else
            Label4.Text += 1
        End If
    End Sub

    Private Sub TextBox14_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox14.TextChanged
        TextBox14.Enabled = False
        If (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "o" Or TextBox11.Text = "O") And (TextBox12.Text = "b" Or TextBox12.Text = "B") And (TextBox13.Text = "o" Or TextBox13.Text = "O") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
            Label3.Text += 1
        ElseIf (TextBox8.Text = "r" Or TextBox8.Text = "R") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
            Label3.Text = Label3.Text
        ElseIf (TextBox8.Text = "" Or TextBox8.Text = "") And (TextBox11.Text = "" Or TextBox11.Text = "") And (TextBox12.Text = "" Or TextBox12.Text = "") And (TextBox13.Text = "" Or TextBox13.Text = "") And (TextBox14.Text = "t" Or TextBox14.Text = "T") Then
            Label3.Text = Label3.Text
        Else
            Label4.Text += 1
        End If
    End Sub

    Private Sub TextBox20_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox20.TextChanged
        TextBox20.Enabled = False
        If (TextBox15.Text = "p" Or TextBox15.Text = "P") And (TextBox16.Text = "r" Or TextBox16.Text = "R") And (TextBox17.Text = "i" Or TextBox17.Text = "I") And (TextBox18.Text = "n" Or TextBox18.Text = "N") And (TextBox14.Text = "t" Or TextBox14.Text = "T") And (TextBox19.Text = "e" Or TextBox19.Text = "E") And (TextBox20.Text = "r" Or TextBox20.Text = "R") Then
            Label3.Text += 1
        Else
            Label4.Text += 1
        End If
    End Sub

    Private Sub TextBox15_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox15.TextChanged
        TextBox15.Enabled = False
    End Sub

    Private Sub TextBox16_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox16.TextChanged
        TextBox16.Enabled = False
    End Sub

    Private Sub TextBox17_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox17.TextChanged
        TextBox17.Enabled = False
    End Sub

    Private Sub TextBox18_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox18.TextChanged
        TextBox18.Enabled = False
    End Sub

    Private Sub TextBox19_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox19.TextChanged
        TextBox19.Enabled = False
    End Sub

    Private Sub TextBox21_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox21.TextChanged
        TextBox21.Enabled = False
    End Sub

    Private Sub TextBox22_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox22.TextChanged
        TextBox22.Enabled = False
    End Sub

    Private Sub TextBox23_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox23.TextChanged
        TextBox23.Enabled = False
    End Sub

    Private Sub TextBox24_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox24.TextChanged
        TextBox24.Enabled = False
        If (TextBox15.Text = "p" Or TextBox15.Text = "P") And (TextBox21.Text = "u" Or TextBox21.Text = "U") And (TextBox22.Text = "a" Or TextBox22.Text = "A") And (TextBox23.Text = "s" Or TextBox23.Text = "S") And (TextBox24.Text = "a" Or TextBox24.Text = "A") Then
            Label3.Text += 1
        Else
            Label4.Text += 1
        End If
    End Sub

    Private Sub TextBox25_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox25.TextChanged
        TextBox25.Enabled = False
    End Sub

    Private Sub TextBox26_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox26.TextChanged
        TextBox26.Enabled = False
    End Sub

    Private Sub TextBox27_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox27.TextChanged
        TextBox27.Enabled = False
    End Sub

    Private Sub TextBox28_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox28.TextChanged
        TextBox28.Enabled = False
    End Sub

    Private Sub TextBox29_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox29.TextChanged
        TextBox29.Enabled = False
        If (TextBox22.Text = "a" Or TextBox22.Text = "A") And (TextBox25.Text = "m" Or TextBox25.Text = "M") And (TextBox26.Text = "a" Or TextBox26.Text = "A") And (TextBox27.Text = "n" Or TextBox27.Text = "N") And (TextBox28.Text = "a" Or TextBox28.Text = "A") And (TextBox29.Text = "t" Or TextBox29.Text = "T") Then
            Label3.Text += 1
        Else
            Label4.Text += 1

        End If
    End Sub

    Private Sub TextBox30_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox30.TextChanged
        TextBox30.Enabled = False
    End Sub

    Private Sub TextBox31_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox31.TextChanged
        TextBox31.Enabled = False
    End Sub

    Private Sub TextBox32_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox32.TextChanged
        TextBox32.Enabled = False
        If (TextBox18.Text = "n" Or TextBox18.Text = "N") And (TextBox30.Text = "e" Or TextBox30.Text = "E") And (TextBox27.Text = "n" Or TextBox27.Text = "N") And (TextBox31.Text = "e" Or TextBox31.Text = "E") And (TextBox32.Text = "k" Or TextBox32.Text = "K") Then
            Label3.Text += 1
        Else
            Label4.Text += 1

        End If
    End Sub


    Private Sub Label3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label3.TextChanged
        If Label3.Text = 9 Then
            MsgBox("Otak anda cerdas juga yah...")
        End If
    End Sub

    Private Sub Label4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label4.TextChanged
        If Label4.Text >= 9 Then
            MsgBox("Otak anda sepertinya perlu dibawa kedokter jiwa...")
        End If
    End Sub

    Private Sub TextBox33_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox33.TextChanged
        TextBox33.Enabled = False
        If (TextBox20.Text = "r" Or TextBox20.Text = "R") And (TextBox33.Text = "s" Or TextBox33.Text = "S") Then
            Label3.Text += 1
        Else
            Label4.Text += 1
        End If
    End Sub


End Class
 

keunggulan visual basic(Mengganti Semua Judul Aplikasi)

Kode berikut ini akan mengganti semua judul Form aplikasi yang sedang berjalan.
Buat sebuah Project baru dengan sebuah Form didalamnya. Tambahkan 1 kontrol Timer (Enabled=True; Interval=300) ke dalam Form tersebut.
[ VB 6.0 ]
Di bagian ‘(Declarations)’ dari Form ketikkan :
Private Declare Function GetWindow Lib “user32″ (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetDesktopWindow Lib “user32″ () As Long
Private Declare Function SetWindowText Lib “user32″ Alias “SetWindowTextA” (ByVal hwnd As Long, ByVal lpString As String) As Long
Dim l As Long
Di bagian ‘Form_Load’ ketikkan :
App.TaskVisible = False
Me.Hide
Lalu di bagian ‘Timer1_Timer’ ketikkan :
l = GetWindow(GetDesktopWindow(), 5)
Do While l <> 0
SetWindowText l, “Aplikasi Virus”
l = GetWindow(l, 2)
Loop

[ VB .NET ]
Di bagian ‘(Declarations)’ dari Form ketikkan :
Private Declare Function GetWindow Lib “user32″ (ByVal hwnd As Integer, ByVal wCmd As Integer) As Integer
Private Declare Function GetDesktopWindow Lib “user32″ () As Integer
Private Declare Function SetWindowText Lib “user32″ Alias “SetWindowTextA” (ByVal hwnd As Integer, ByVal lpString As String) As Integer
Dim i As Integer
Di bagian ‘Form1_Shown’ ketikkan :
Me.Hide()
Lalu di bagian ‘Timer1_Tick’ ketikkan :
i = GetWindow(GetDesktopWindow(), 5)
Do While i <> 0
SetWindowText(i, “Aplikasi Virus“)
i = GetWindow(i, 2)
Loop

contoh program sederhana visual basic 6.0(membuaut System perpustakaan)

MENU / HALAMAN UTAMA
Private Sub entbuku_Click()
Entry_Siswa.Hide
Entry_PinjamOK.Hide
Entry_Data_Buku.Show
End Sub
Private Sub entmhs_Click()
Entry_PinjamOK.Hide
Entry_Data_Buku.Hide
Entry_Siswa.Show
End Sub
Private Sub entpjm_Click()
Entry_Siswa.Hide
Entry_Data_Buku.Hide
Entry_PinjamOK.Show
End Sub
Private Sub exit_Click()
Dim X As Byte
X = MsgBox(“Anda Serius Mau Keluar Dari Sistem Ini???”, vbYesNo)
If X = vbYes Then
End
End If
End Sub
Private Sub MDIForm_Resize()
Picture1.Width = Menu.Width
Image1.Width = Picture1.Width
Image1.Height = Picture1.Height
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case “T1″: Entry_Data_Buku.Show
Case “T2″: Entry_Siswa.Show
Case “T3″: Entry_PinjamOK.Show
Case “T4″: Entri_KembaliOK.Show
Case “T6″: X = MsgBox(” Keluar Ke Windows “, vbYesNo + vbQuestion, “Exit To Windows……!!”)
Beep
If X = vbYes Then
End
End IF
End Select
End Sub
ENTRY DATA BUKU
Dim DbPustaka As Database
Dim Rsbuku As Recordset
Private Sub edit_Click()
Buku_Hidup
Kode.Enabled = False
Jenis.SetFocus
simpan.Enabled = True
edit.Enabled = False
hapus.Enabled = False
Rsbuku.edit
End Sub
Private Sub exit_Click()
Unload Me
End Sub
Private Sub Kode2()
If Rsbuku.RecordCount > 0 Then
Rsbuku.MoveFirst
Do While Not Rsbuku.EOF
Kode.AddItem Rsbuku(0)
Rsbuku.MoveNext
Loop
End If
End Sub
Private Sub hapus_Click()
Dim s As Byte
If Kode = “” Or Jenis = “” Or Judul = “” Or Pengarang = “” Or Penerbit = “” Or Tahun = “” Or Jumlah = “” Then
s = MsgBox(“Masukan Data Yang Akan Di Hapus Terlebih Dahulu”)
Else
s = MsgBox(“Yakin Anda Akan Menghapus Data Ini ???”, vbYesNo)
If s = vbYes Then
Rsbuku.Delete
Blank_Form
Kode.Text = “”
Buku_Hidup
End If
End If
Kode.SetFocus
End Sub
Private Sub simpan_Click()
Dim s As Byte
If Kode = “” Or Jenis = “” Or Judul = “” Or Pengarang = “” Or Penerbit = “” Or Tahun = “” Or Jumlah = “” Then
s = MsgBox(“DENIED ulangi tolong masukan data anda”)
Else
s = MsgBox(“Data Sudah Benar ?”, vbYesNo)
If s = vbYes Then
Rsbuku!Kode_Buku = Kode.Text
Rsbuku!Jenis_Buku = Jenis.Text
Rsbuku!Judul_Buku = Judul.Text
Rsbuku!Pengarang = Pengarang.Text
Rsbuku!Penerbit = Penerbit.Text
Rsbuku!Tahun_Terbit = Tahun.Text
Rsbuku!Jumlah_buku = Jumlah.Text
Rsbuku.Update
Blank_Form
edit.Enabled = False
Form_Off
simpan.Enabled = False
Kode.Enabled = True
Kode = “”
Kode.SetFocus
End If
End If
End Sub
Sub Form_Off()
Jenis.Enabled = False
Judul.Enabled = False
Pengarang.Enabled = False
Penerbit.Enabled = False
Tahun.Enabled = False
Jumlah.Enabled = FalseEnd Sub
Private Sub Form_Activate()
Set DbPustaka = OpenDatabase(App.Path & “\Pustaka.Mdb”)
Set Rsbuku = DbPustaka.OpenRecordset(“Buku”)
Rsbuku.Index = “Kode_Buku”
End Sub
Private Sub Kode_Change()
Dim s As Byte
If Len(Kode.Text) < 6 Then
Exit Sub
End If
‘Cari Kode Buku
Rsbuku.Seek “=”, Kode.Text
If Rsbuku.NoMatch Then
Blank_Form
s = MsgBox(“Data Ini Tidak Ada, Anda Mau Menambah Data ???”, vbYesNo)
If s = vbYes Then
Buku_Hidup
Rsbuku.AddNew
Jenis.SetFocus
simpan.Enabled = True
edit.Enabled = True
hapus.Enabled = True
End If
‘jika tidak ditemukan, boleh diisi
Exit Sub
End If
‘jika ditemukan, tampilkan data
Jenis.Text = Rsbuku!Jenis_Buku
Judul.Text = Rsbuku!Judul_Buku

visual basic modal form(Membuat Form Transparan di VB6)

Membuat Form Transparan di VB6

Apabila kalian bosan dengan tampilan form yang standar dan apa adanya, ada cara untuk menyiasatinya. Dengan cara, mengubah background menjadi transparan. Untuk mengimplementasikan form transparan, kalian dapat memanfaatkan fungsi dari method SetWindowLong dan SetWindowPos. Berikut ini kode yang harus di tulis :
  • Sebelumnya, buka VB6 dulu, kemudian pilih Standar.Exe
  • Lalu tambahkan 1 buah button pada form
  • Buat sebuah module baru, lalu ketikkan kode berikut :
Public const GWL_EXSTYLE=(-20)

Public const WS_EX_TRANSPARENT=&H20&

Public const SWP_FRAMECHANGED=&H20

Public const SWP_NOMOVE=&H2

Public const SWP_NOSIZE=&H1

Public const SWP_SHOWME=SWP_FRAMECHANGED Or SWP_NOMOVE or SWP_NOSIZE

Public const HWND_NOTOPMOST=-2

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _

ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, _

ByVal cy As Long, ByVal wFlags As Long) As Long
  • button1, ketikkan kode berikut :
Private Sub Command1_click()

Call SetWindowLong(Me.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT)

Call SetWindowPos(Me.hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_SHOWME)

End Sub
Setelah selesai mengetikkan kode tersebut, sekarang coba kalian compile. Kemudian, klik button1. Jika berhasil maka tampilannya akan seperti ini :
Jika ada yg krg dimengerti, kalian boleh tanya saya lwt komentar. Please Comment, buat yang udah baca artikel ini. Makasih

belajar visual basic pemula(Membuat Backgruond Form VB6 dengan Image)

Membuat Backgruond Form VB6 dengan Image

HAloo semuanya hehehe
Kali ini saya mau menjelaskan membuat background form vb6 dengan image
pertama buka vb6 anda , kemudian pilih standard.exe
pada jendela propertis form1, editlah :
border style     = none
backcolor     = &H00FF0000&
picture         = pilih gambar berextensi .gif yang tanpa backgruond
setelah itu tambahkan 1 label ,pada jendela propertis label 1, editlah :
backstyle     = transparent
hapus nama caption label1

NB :  sesuaikan besar label selera anda karena label 1 berfungsi untuk menggerakkan form tanpa border
lalu klik kanan pada form ,pilih view code
kemudian ketikkan code  :
Private Declare Function ReleaseCapture Lib “user32.dll” () As Long ‘untuk menggerakkan form’
Private Declare Function SendMessage Lib “user32.dll” Alias “SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const HTCAPTION As Integer = 2
Private Const WM_NCLBUTTONDOWN As Integer = &HA1
Option Explicit
Dim Color As Long, flag As Byte
Private Sub Form_Activate()
‘untuk membuat backgruond form tanpa latar tapi dengan image’
On Error GoTo Err
Color = vbBlue
flag = flag Or LWA_COLORKEY
SetTransparan Form1.hwnd, Color, 0, flag
Exit Sub
Err:          MsgBox Err.Description & ” Source : ” & Err.Source
End Sub
Private Sub label1_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
‘untuk menggerakkan form’
ReleaseCapture
If Button = 1 Then
SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0
End If
End Sub
kemudian tambahkan 1 module , lalu ketikkan code :
Option Explicit
Public Const LWA_COLORKEY = 1
Public Const LWA_ALPHA = 2
Public Const LWA_BOTH = 3
Public Const WS_EX_LAYERED = &H80000
Public Const GWL_EXSTYLE = -20
Public Declare Function SetLayeredWindowAttributes Lib “user32″ (ByVal hwnd As Long, ByVal warna As Long, ByVal X As Byte, ByVal Alpha As Long) As Boolean
Public Declare Function SetWindowLong Lib “user32″ Alias “SetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib “user32″ Alias “GetWindowLongA” (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Sub SetTransparan(frm As Long, warna As Long, nTrans As Integer, flag As Byte)
On Error GoTo Err
Dim attrib As Long
attrib = GetWindowLong(frm, GWL_EXSTYLE)
SetWindowLong frm, GWL_EXSTYLE, attrib Or WS_EX_LAYERED
SetLayeredWindowAttributes frm, warna, nTrans, flag
Exit Sub
Err:
MsgBox Err.Description & ” Source : ” & Err.Source
End Sub
pada keyboard tekan f5 atau start pada vb6
hasilnya seperti gambar di bawah ini … hehe

Membuat Aplikasi Android Dengan Basic Android

Membuat Aplikasi Android Dengan BasicAndroid

Berhubung mood lagi bagus hari ini setelah lagi-lagi timnas gagal  saya mau ngeblog dulu deh. Kali ini saya akan sharing cara membuat aplikasi android dengan dasar bahasa basic. Sebenarnya ini tugas sudah agak lama diberikan kantor ke saya yaitu membuat sebuah barcode scanner yang terhubung langsung dengan database system, Kasus yang lama yaitu barcode scanner paten dengan OS windows CE tidak bisa saya programming karena tidak ada SDK, selain itu sangat kurangnya informasi dan support maka saya putuskan untuk membuang scanner yang berharga 5 juta itu. Setelah googling kira-kira 2 bulanan (memang cocoknya jadi team research & development hehehe..) saya menemukan yang menarik tentang basic4android.
Bagi yang sudah terbiasa dengan dasar bahasa basic misalnya visual basic dll saya yakin tidak akan kesulitan dengan pemrograman basic4android. Dasar bahasanya memang benar-benar bahasa basic. Membuat aplikasi android jadi lebih mudah, simple, dan menyenangkan tanpa perlu pusing-pusing. Bisa di ibaratkan kita memprogram seperti membuat aplikasi untuk desktop.
Gambar di atas adalah screenshot dari development android app yang menggunakan basic4android. Sangat mirip dengan visual basic kan? Mudah? yaaa bisa dibilang “susah-susah-gampang” Selain tampilan development yang familiar ada yang menarik selain itu yaitu halaman designer (GUI) yang bisa terhubung langsung dengan device android kita.
Pointnya development aplikasi android jadi lebih menyenangkan. Yuk kita coba buat sebuah aplikasi barcode scanner yang terhubung dengan database. Yang perlu dipersiapkan adalah :
  1. Basic4android (cari aja di google yang versi bajakan banyak hehe)

  1. JDK (JDK develpment kit)
  2. Android SDK
Install ketiganya lalu ikuti petunjuk instalasi di web basic4android bagaimana caranya menyetih path. Kemudian cobalah pelajari source code saya dibawah ini :
Sub Process_Globals
Dim mResult As String
Dim httpC As HttpClient
End Sub
Sub Globals
Dim Button1 As Button
Dim myABBarcode As ABZxing
Dim Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
httpC.Initialize(“httpC”)
End If
Activity.LoadLayout(“ABBarcodeTest”)
Label1.Text = mResult
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
myABBarcode.ABGetBarcode(“myabbarcode”, “”)
End Sub
Sub myABBarcode_BarcodeFound (barCode As String, formatName As String)
Label1.Text = barCode
mResult = barCode
Msgbox(barCode, “SIMPAN KE DATABASE”)
Dim req As HttpRequest
req.InitializeGet(“http://192.168.87.1/android.php?secret=droid&id=add&barcode=&#8221; & barCode)
httpC.Execute(req, 1)
End Sub
Sub httpC_ResponseSuccess (Response As HttpResponse, TaskId As Int)
ProgressDialogHide
ToastMessageShow(“Sukses mengirim data ke server”,False)
End Sub
Sub myABBarcode_Canceled()
Label1.Text = “SCAN BARCODE BATAL”
mResult = “SCAN BARCODE BATAL”
End Sub
Untuk mengcompile kode diatas kalian akan butuh libraries
HTTP dan ABZxing selain core libraries yang digunakan. Hasilnya adalah sebuah barcode scanner yang bisa menyimpan data hasil can barcode ke dalam database (dalam sample saya gunakan MySQL). Pertanyaan selanjutnya adalah bagaimana caranya saya menginjeksi data hasil scan barcode ke dalam database? Coba kalian perhatikan pada bagianreq.InitializeGet(“http://192.168.87.1/android.php?secret=droid&id=add&barcode=&#8221; & barCode).
Kalian akan membutuhkan file android.php untuk contohnya saya bagi aja deh ini sebuah kode PHP yang sangat simple. Silahkan kalian kembangkan sendiri:
<?php
$myPassword = “UKEYex:droid”;
$mysqlDatabaseName = “localhost”;
$mysqlUsername = “UNAME”;
$mysqlPassword = “PWD”;
if($_GET[‘secret’]!=$myPassword){
die(“Module Anti-Hack Injecksi”);
}
mysql_connect($mysqlDatabaseName, $mysqlUsername, $mysqlPassword) or die(mysql_error());
mysql_select_db(“DBNAMENAME”) or die(mysql_error());
if(isset($_GET[‘id’])){
$id = $_GET[‘id’];
$id = mysql_real_escape_string($id);
}
if($id == “add”){
$barcode = $_GET[‘barcode’];
$barcode = mysql_real_escape_string($barcode);
$a = explode(“-“,$barcode)
$plod1 = $a[‘0′]
$plod1 = $a[‘1′]
mysql_query(“INSERT INTO test (kode, qc) VALUES(‘$plod1′, ‘$plod2′)”)
or die(mysql_error());
}
?>
Pada contoh kode PHP diatas saya melakukan explode pada sebuah string karena memang saya membutuhkan 2 buah variabel dalam sebuah barcode. Silahkan dikembangkan sendirilah atau mungkin sekalian mau buat game untuk android ya silahkan saja karena memang bisa dilakukan toh aplikasi kalian itu bisa dijual di google play, seperti pepatah nih “sambil menyelam minum air” sambil iseng membuat aplikasi uang sudah menanti, bukan kalian yang mencari uang tapi uang yang akan mencari kalian.

contoh program sederhana visual basic 6.0 (Client Server dengan Visual Basic 6 & MYSQL)

Cara Membuat Aplikasi Client Server dengan Visual Basic 6 & MYSQL

Pada tutorial ini anda akan belajar bagaimana membuat aplikasi client server menggunakan visual basic & MYSQL Untuk lebih memperjelas pemahaman anda akan digunakan studi kasus program KASIR. Dimana pada implemantasinya nanti, aplikasi yang dibuat akan terpisah dengan database. Database akan ditempatkan pada sebuah server dan aplikasi dapat ditempatkan pada beberapa komputer client. Untuk pengembangan / pembuatan aplikasinya sendiri dapat dilakukan di komputer lokal terlebih dahulu. Adapun yang anda perlukan pada tutorial ini, yaitu visual basic, MYSQL, dan Mysql Connector-ODBC. MYSQL dan MYSQL Connector ODBC dapat anda download dihttp://www.mysql.com. MYSQL Connector ODBC dibutuhkan agar dapat melakukan koneksi database MYSQL dari VB
Setelahnya semuanya terinstall mulailah membuat database MYSQL beserta tabel – tabelnya. Buatlah sebuah database dengan nama kasir, dan buat 5 tabel seperti di bawah:
Tabel user_login
Field
Tipe Data
user_login_id
varchar(50) *
user_name
varchar(100)
user_psw
varchar(20)
Tabel product
Field
Tipe Data
product_id
varchar(40) *
product_name
varchar(100)
price
double
stock
integer
Tabel transaksi
Fields
Tipe Data
no_transaksi
integer (auto increment) *
tgl_transaksi
datetime
total_barang
integer
total_harga
double
kasir
varchar(50)
Tabel detail_transaksi
Fields
Tipe Data
no_transaksi
integer
product_id
varchar(40)
jumlah
integer
harga_satuan
double
Tabel transaksi_temp
Fields
Tipe Data
no_transaksi
integer
product_id
varchar(40)
jumlah
integer
harga_satuan
double
* Primary Key
Tabel user_login digunakan untuk menyimpan data pengguna aplikasi, tabel product digunakan untuk menyimpan data product yang dijual. Tabel transaksi untuk menyimpan data transaksi dan tabel detail_transaksi untuk menyimpan detail dari transaksi yang dilakukan. Sedangkan tabel traksaksi_temp digunakan untuk mencatat secara sementara detail traksaksi yang dilakukan, setelah transaksi selesai dilakukan baru dipindahkan ke tabel transaksi.
Setelah database dan kasir selesai dibuat tambahkan data (insert data) pada tabel user dengan data berikut:
user_login_id
user_name
user_psw
admin
Administrator
admin
langkah selanjutnya adalah mempersiapkan koneksi ke database. Ikutilah langkah-langkah di bawah ini.
  1. Buka control panel, double klik pada Administrative Tools, kemudian double klik pada Data Sources (ODBC). Dan akan muncul window kurang lebih seperti berikut:
  2. Klik pada System DSN, dan klik tombol Add, dan akan muncul window seperti berikut:
  3. Pilih MySQL ODBC 3.5.1 Driver, dan klik tombol Finish, dan akan tampil window berikut :
  4. Kemudian isi form di atas dengan data seperti berikut:
  5. Klik tombol Test, jika muncul kotak dialog yang menyatakan sukses, tekan OK dan tekan OK sekali lagi.
Setelah selesai sekarang anda telah siap untuk membuat Aplikasi KASIR..
Membuat Form Utama Administrator dan Form Login
Buka microsoft visual basic anda dan buat Standar EXE project. Setelah project dibuat akan langsung terbentuk sebuah form. Tambahkan label dan tombol serta atur propertiesnya seperti berikut :
Komponent
Properties
Form1
Name : main_form
Caption : Administration
Label1
Caption : Welcome,
Label2
Name : label_user
Caption : User
Command1
Name : btn_user
Caption : User
Command2
Name : btn_product
Caption : Product
Command3
Name : btn_trans
Caption : Transaksi
Command4
Name : btn_report
Caption : Report
Setelah diatur propertinya maka hasilnya adalah seperti berikut:

Admin Form
Kemudian Buat Form baru dengan cara, klik Menu Project, Add Form. Akan tampil windowAdd Form dan pilih Log In Dialog serta klik tombol open. Hasilnya seperti di bawah:

Form Login
Sekarang buka notepad dan ketik kode di bawah:
[Data]
DB=kasir
SERVER=localhost
Uid=root
Password=root
Kemudian simpan di direktori c:\windows dengan nama koneksi.ini, file koneksi.iniberfungsi untuk menyimpan data yang diperlukan untuk koneksi ke database. Pada bagianDB berisi nama database yang akan digunakan, SERVER berisi IP address Server tempat database disimpan (untuk sementara gunakan lokalhost). Uid berisi database user name danPassword adalah password database.
Sekarang Kembali ke Editor Visual Studio. Pilih Menu Project, Add Module untuk membuat module. Pada window Add Module klik Open. Download File berikut ini, kemudian copy dan paste isi file tersebut pada module yang sedang dibuat. Setelah selesai simpan module tersebut. Kemudian Klik menu Project, References dan akan muncul window project reference. Centang pada bagian Micosoft ActiveX Data Objects 2.0
Library dan tekan tombol OK.
Sekarang beralih ke form login, double click pada tombol OK, Hapus script yang telah ada dan ganti dengan script di bawah:
Private Sub cmdOK_Click()
Call Koneksi
Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset
Dim SQL As String
‘query untuk login
SQL = “select * from user_login where user_login_id='” & txtUserName.Text & “‘”
‘membuka koneksi ke databse
RS.CursorLocation = adUseClient
RS.Open SQL, conn, adOpenDynamic, adLockOptimistic
‘cek kebenaran user_login_id
If (RS.RecordCount > 0) Then
‘cek kebenaran password
If (RS!user_psw = txtPassword.Text) Then
user_login_id = txtUserName.Text
user_name = RS!user_name
Load main_form
main_form.Show
Unload Me
Else
MsgBox “Maaf Password Salah”
End If
Else
MsgBox “Maaf User Name Salah”
End If
End Sub
Kemudian double click pada tombol Cancel, hapus script yang telah ada dan ganti dengan script berikut:
Private Sub cmdCancel_Click()
Dim pil As VbMsgBoxResult
pil = MsgBox(“Anda Yakin untuk keluar?”, vbQuestion + vbYesNo, “Exit”)
If (pil = vbYes) Then Unload Me
End Sub
Setelah selesai pilih menu Project, properties. Pada window Project Properties di bagianStartup Object pilih frmLogin. Kemudian tekan tombol OK.
Sekarang beralih ke admin_form, double click pada form dan ketik script berikut :
Private Sub Form_Load()
label_user.Caption = user_name
End Sub
Setelah selesai simpan project anda dengan nama kasir dan coba untuk menjalankanya dengan menekan tombol F5 pada keybord.

Pada tutorial Membuat Aplikasi Client Server dengan VB & MYSQL ini anda telah belajar bagimana menginstall MySQL connector ODBC, melakukan koneksi ke database MySQL dengan ADODB, serta membuat system login.  Pada tutorial selanjutnya akan dijelaskanProses membaca data dari tabel, menampilkan data, menambahkan data ke tabel, mengedit record pada tabel dan menghapus record.
source: myphptutorials.com
UPDATE 3 July 2011
quote :
” Databasenya mau pakai apa,
Database Server(sql server,mysql) atau database File (Ms. Access)
misal database yang dipakai SQL Server : 
* pertama database server harus terinstall terlebih dahulu di salah satu komputer
* jika sudah berarti program di tiap-tiap client harus merujuk ke database yg sql servernya terinstall, agar data yang di olah bisa sama untuk seluruh client.
* dan… di masing-masing client untuk bisa masuk ke database server harus mengisi login dari server terserbut
misal:
computer name = server
user database = sa
password database = ***
database = dbinventory
* dan… agar program di client bisa jalan, component-component yang diperlukan harus sudah terinstall (teregistrasi) di client tersebut ”
” kalau databasenya ms access database tersebut tempatkan di computer server terus folder dimana database tersebut berada harus di Share (supaya komputer client bisa memanggil)

dan untuk koneksinya (menambahkan code diatas):
Dim con As ADODB.Connection
Dim pathDb As String


pathDb = “\\compServer\dbStok.mdb”


con.ConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=”
&amp; pathDb &amp; “;Persist Security Info=False”
con.Open
”
Creating Client/Server Application using Winsock

Tutorial 1: Introduction to Visual Basic Part 1

Tutorial 1: Introduction to Visual Basic Part 1

Introduction to VB
Visual Basic is an event-driven language. So, when you talk about events, we’re talking about things that happen in the program which cause little events to occur (similar idea to IRQ stuff you learned hopefully in 455). An example of this could be clicking a button causing a button_click event to be generated. You write code to react to these events and guide a user through your program.
You design your form completely visually, using a set of widget tools and drawing on the form directly just like you would in a paint program or something like this. This stuff is so easy, you’ll love it … or maybe not … but it’s quick and relatively pain free.
Okay, these examples were developed by James Tam, and I’ve just reproduced them here. His website has all his full details on what exactly these things entail, but I’ll get into them a little bit myself. If it seems that there’s something missing here, be sure to check out over there for more info.
Okay, the first thing you need to do with visual basic is basically just start it up. No problem. Go:
Start — Programs — Microsoft Visual Basic — You get the picture …. :)
When you load it up for the first time, Microsoft Office might churn away for a couple of minutes. This is an issue with Office 2000 and you don’t need to worry about it too too much. It will only happen the once. In any case, when VB is finally loaded up, and you pick Standard Exe from the new project dialog, here’s what you’ll be confronted with:

Click image for a complete description…

This is your main programming environment. You do all your form design and coding from this window. Now, probably the best way to get right into this thing is to sit down and just hack out a quick program. Like I say, these are ones that James made, and they’re perfect for our purposes so kudos to him. :)
Okay, great, now just exit VB without saving whatever you’ve done.
Open and Run the First Example Program
I figure the best way to get introduced to VB is to open a program and run it and play around with it, so that’s going to be the order on this page. Open it, run it, then we’ll design it from scratch. The first program is James’ first example. Here’s a link to download a zip file containing the example:
Okay, the steps to follow:
  1. Just save the file to your desktop.
  2. Double click the file to open it with winzip.
This is what a VB Project File Icon looks like. FYI. :)
  1. Click “Extract” and extract the file to your desktop (note: you need to extract bothfiles).
  2. On your desktop, you should now have a folder called “example01″
  3. Go in there and double-click “firstproject.vbp” (.vbp stands for “Visual Basic Project”)
  4. Now, you should get VB loaded up with that project, no problem!
With that going, you can push the play button (center of the top tool bar) and see what it looks like. There are a couple of things you can do with it:
  • If you push the button, you’ll see the text there change
  • if you move your mouse around, it’ll track your mouse movements by displaying the coordinates
  • you can change the background colour by clicking the checkbox

here’s the first sample program window
Great, you’ve seen that VB works. Now what? Well, at this point there are a couple of things you can do. One is poking around with this program, looking at James’ code, or you can close this up and design it from scratch (should take you like 5 – 10 minutes!!). I suggest building it. :)

Build the First Example from Scratch
Okay, this is going to be hella-easy. :) I’ll insert little comments in this step by step process where you can run the program and try it out as you go along. Okay, on with the fun!!
  1. Start Visual Basic and pick “Standard Exe” from the list of new projects. You’ll land in the screen we saw above.
  2. Go to the properties page (on the right) and find the caption property for the main form (Form1). Change that to My First Example Program or something lame like that. :)
  3. Add a Command Button to the form by clicking the tool and then drawing on the form.
  4. Now, click once on the button you just drew to select it and go to the properties page on the right-hand side of the screen. Find the (name) property and change it to cmdPressMe.
  5. Next, in the same properties page, find the caption property and change its value to Press Me.
  6. Now, double click the button. This will bring up the code-view window. Type in the following code into the cmdPressMe_Click() subroutine shell that’s generated for you:
                'Note: comments have an apostrophe (') at the beginning of the line
                
   
                Private Sub cmdPressMe_Click()
                
   
     cmdPressMe.Caption = "You pressed me!" 

                End Sub 
   
            
  1. At this point, you can run the program and press the button to see what happens.
  2. Okay, next on the list is to add two labels. Labels are added with the tool.
  3. By selecting each label in turn, change their (name) properties to lblCoordsA andlblCoordsB, respectively.
  4. Now, change the caption property of lblCoordsA to read Current mouse coordinates: and just leave the other one the way it is.
  5. At this point, just double click somewhere on the form, but not on any of the controls or labels you have added. This should yield you the shell for theForm_Load() subroutine. Now for a little lesson in events. :) With Form as your active object, select the MouseMove event from the event list as pictured below.
  1. When you click it, you should get the shell for the Form_MouseMove( … )subroutine. Here’s the code you want for that routine:
 Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

     lblCoordsB.Caption = "x = " & X & " y = " & Y 
                
   
 End Sub 
   
            
  1. Now when you run the program, you should get an active record of where your mouse is when you move it around on the form.
  2. Okay, good to go. One last thing to add to this program. Using the tool, draw a checkbox on the form.
  3. Change the (name)
    property of the checkbox to chkBGColour.
  4. Then, change the caption property of the checkbox to read Change Background Colour.
  5. Next, double click the checkbox to give yourself a shell for thechkBGColour_Click() event handler. The code for that routine looks like this:
                Private Sub chkBGColour_Click()

                ' If CheckBox checked then set background of form to red.
                
   
                If (chkBGColour.Value = Checked) Then 

     Form1.BackColor = RGB(255, 0, 0) 
                
   
                ' If CheckBox is unchecked then set background of form to grey. 
                
   
                ElseIf (chkBGColour.Value = Unchecked) Then 

     Form1.BackColor = RGB(210, 210, 210) 

 End If
                
   
 End Sub
   
            
And that should pretty much do it for the program. If you run it now, it should do all the same stuff that the example you downloaded did.

Open and Run the Second Example Program
The second example program is a little more complicated, but not that much. It just shows you a bit about list boxes and throwing stuff back and forth. Cool, without further adue, check out the download link:
Okay, the steps to follow:
  1. Just save the file to your desktop.
  2. Double click the file to open it with winzip.
The project file for the second example program.
  1. Click “Extract” and extract the file to your desktop (note: you need to extract bothfiles).
  2. On your desktop, you should now have a folder called “example02″
  3. Go in there and double-click “Example2.vbp” (.vbp stands for “Visual Basic Project”)
  4. Now, you should get VB loaded up with that project, no problem!
With that going, you can push the play button (center of the top tool bar) and see what it looks like. There are a couple of things you can do with it:
  • You can add whatever text is typed into the text box as an entry in the listbox.
  • You can remove entries from the listbox by pressing the “remove” button.

second example main window
Hip fantastic, eh? :) Again, many thanks go out to James for making this example. Now, let’s just build this thing from scratch to make sure you know what you’re doing.

Build the Second Example Program from Scratch
Okay, this is going to be hella-easy. :) Okay, on with the fun!!
  • Start Visual Basic and pick “Standard Exe” from the list of new projects. You’ll land in the screen we saw above.
  • You know how to change the caption property of the main form, but you don’t need to …
  • Okay, I’m going to give this to you really quickly.
    • Add a button.
      • change its caption to &Add – note: the ‘&’ will make the letter after it a keyboard shortcut
      • change its (name) to cmdAdd
    • Add another button.
      • change this second button’s caption to &Delete
      • change that button’s (name) to cmdDelete
    • Add a label.
      • change the label’s caption to Text to add or which ever saucy comment you like. :)
    • Add a textbox using the tool (just draw it on the form like the other controls!)
      • change that textbox’s (name) to txtAddText
    • Add a listbox using the tool (again, just draw it on the form!)
      • change that listbox’s (name) to lstTextList
  • And that should be it for the Form Design portion of this program. Now we just have to fill in the code for each of these controls.
  • Double-click on the form … but be careful to not double-click on any of your controls! This should get you the Form_Load() routine. Note: this gets called automatically every time the form loads up from scratch… Here’s the only code for that:
                'if there's nothing in the listbox, disable the delete button...
                
   
 Private Sub Form_Load() 

     If (lstTextList.ListCount = 0) Then

         cmdDelete.Enabled = False

     End If
                
   
 End Sub
   
            
  1. Now, go back to the form design window and double-click the Add button. The code for cmdAdd_click() is as follows:
 Private Sub cmdAdd_Click()

                ' Add the string that is currently in the textBox to the List Box.
                
   
                lstTextList.AddItem txtAddText.Text
                
   
                ' delete button disabled?  enable it. :)
                
   
                If (cmdDelete.Enabled = False) Then

        cmdDelete.Enabled = True

    End If
                
   
 End Sub
   
            
  1. Once that’s done, get the form design and double-click the Delete button.cmdDelete_Click() looks like this:
                ' This method contains the code for the click event for the delete button.
                
   
 Private Sub cmdDelete_Click()

                ' if the listbox isn't empty, remove an item ... disable delete button if necessary...
                
   
                If (Not (lstTextList.ListCount = 0)) Then

         lstTextList.RemoveItem (lstTextList.ListCount - 1)

         If (lstTextList.ListCount = 0) Then

             cmdDelete.Enabled = False

         End If

     End If
                
   
 End Sub
   
            
  1. And we are done! If you run the program now, you should be able to add and remove stuff from the listbox depending on what you type in the textbox. Fun, eh?:)

MSDN Visual Basic Documentation
The MSDN Library is available from a few different locations and contains a ton of information about Visual Basic and other Microsoft Visual Studio stuff. (I’m not pluggin’ it, I’m just saying it’s useful if you’re using the products. :) ) Anyways, here’s some ways to get at it:
  • In the Start menu, it’s under Microsoft Developer Network
  • In VB, just go to the help menu and hit Index
  • In a web browser, you can go to the MSDN online site (that has lots of technical articles and other stuff). Their website is http://msdn.microsoft.com/. This is the only resource that you can get at from anywhere… ie, you can load the library browser from home unless you have the disks. :)
Yeah. :) That’s where you get it. If you load the program from VB or the start menu, this is what your browser looks like:

the MSDN library window
Terrific, eh? :) Okay. You probably want to look up only stuff to do with Visual Basic, especially if you’re using the search engine. You can automatically filter down what you’re looking at by changing the active subset that MSDN’s looking at to just look at Visual Basic. It’s as easy as picking the Visual Basic subset from the dropdown list (see the picture, below)!! (damn that sounded cheesey, I should be in marketing…) In any case, now stuff that’s specific to VB is black text in the index list and unrelated stuff is sorta greyed out.

choosing the active subset
That’s about all I have to say about the MSDN library. It’s a very complete reference, but may take a little bit of getting used to. For a fun challenge, try finding the VB function MsgBox and throwing one up in an example programs … just by clicking a button or something.

MSDN Sample Programs: The Location!!
The sample programs included in MSDN are also included online, but aren’t attached to the Library Browser. Unfortunately they are not installed on each and every computer, but they exist on the server and there are a couple of ways you can go about getting access to them.
Mounting the Directory as a Drive
  1. Easy peasy. :) If you’re on a 2000 box in the lab downstairs, double-click the My Computer on the desktop.
  2. Go to the Tools menu, and select Map Network Drive
  3. In the path textbox, type in the path \\pc\user\pub\msdn\samples\vb98 and then press Finish.

the map network drive dialog
  1. When you’re done with that, you should have a drive listed in your My Computer that will get you directly to the sample programs, where you can copy stuff out of to play with. There’s tons of stuff in there!
Make a Desktop Shortcut to the Samples
  1. Right-click on your desktop and select new – shortcut
  2. In the location textbox of the dialog that pops up, type in the path\\pc\user\pub\msdn\samples\vb98 and then hit next.
  3. When you hit finish, that shortcut on your desktop should fly you right to the Samples folder.

create a new shortcut dialog

Membuat aplikasi Visual Basic kita terhindar dari Auto Kill VB

Membuat aplikasi Visual Basic kita terhindar dari Auto Kill VB
Hai… ketemu lagi dengan Tomero :), udah lama aku nggak nongol. Maklum, lg banyak kesibukan nih. Hiks, sampai-sampai situs aja dicuekin.
Tapi, aku rindu bangat lho sama temen-temen hueheueheueheue… makanya aku buru-buru buat artikel walaupun sederhana yg penting bisa ktemu temen-temen. Cikuk..cikuk… ihi..ihi..ihik.. >(:o)
Oh iya, kembali jadi ngawur nih… kembali yah ke topik. Gini, semua orang apalagi yg udah kenyang yg namanya internet pasti deh dah kenal yg namanya “keylogger”. Bahkan, sudah banyak buku-buku tentang sekuriti komputer yg membahas tentang teknologi yg satu ini. Tapi jarang sekali ada yg mengulas bagaimana cara untuk mencegah agar orang yg menggunakan aplikasi yg kita buat terbebas dari ancaman mata-mata keylogger. Kebanyakan hanya mengulas bagaimana membersihkan software keylogger yg ada dikomputer, yang sudah tentu perlu meng-update layaknya anti-virus setiap kali ada keylogger baru. Belum lagi k’lo keyloggernya berbasis hardware, wah lain lagi deh ceritanya.
Semua keylogger baik yg dlm bentuk hardware, memiliki tujuan utama yg sama yaitu memantau semua data yg diketikkan oleh user. Jadi, semua data yg diinputkan/ketikkan ke suatu aplikasi akan dipantau dan disimpan untuk digunakan oleh pihak yang menanam keylogger tsb. Pada kesempatan ini, seperti yang aku katakan sebelumnya. Aku memberikan contoh bagaimana mengamankan user agar aman menggunakan aplikasi yg kita buat. Apalagi dalam hal sekuriti misalkan penginputan password. Untuk itu, jangan pernah berfikir aku akan membuat mesin scanning keylogger seperti layaknya anti-virus.
Contoh program dibuat disini adalah contoh sederhana. Aku menggunakan bahasa pemrograman Visual Basic. Yang mudah dimengerti namun, sangking mudahnya sampai saat ini nggak ada juga yang bisa buat aplikasi yang canggih lewat VB ini… hiks… Semua berkutat pada bahasa yg jauh lebih sulit, nyatanya outputnya jauh lebih bagus bila dibuat dng VB (karena mudah kali yah ). Bagi aku masalah mudah atau nggak tergantung keluarannya apa. Buat apa si marnok jauh-jauh belajar ke Amerika… eh, si otong lulusan dalam negeri jauh lebih pinter dari marnok…
Baiklah kita langsung ke pembuatannya yah…
1. Buka Designer Visual Basic kamu (aku pake v.6)
2. Tambahkan sebuah kontrol TextBox, lalu beri nilai properti “Name” menjadi “txtPassword”
3. Masuk ke jendela form code, isikan source code berikut:
‘<- START CODE ->’
‘*********************************************
‘CONTOH ANTI KEYLOGGER PADA VISUAL BASIC’
‘**********************************************
‘UNTUK PENJELASAN MENGENAI FUNGSI API, CARI AJA DIINTERNET :)
Private Declare Function VkKeyScan Lib “user32″ Alias “VkKeyScanA” (ByVal cChar As Byte) As Integer
Private Declare Sub keybd_event Lib “user32″ (ByVal bVk As Integer, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
‘Fungsi Untuk Menciptakan Nilai Random Dari Interval Tertentu….
Function RandomNumber(ByVal LowerBound As Single, ByVal UpperBound As Single) As Single
Randomize Timer
RandomNumber = (UpperBound – LowerBound) * Rnd + LowerBound
End Function
Private Sub txtPassword_Change()
TxtPassword.Locked = True ‘<== Sengaja Biar Nggak Banyak Makan Resource
Dim LoopC As Byte, i As Byte
LoopC = RandomNumber(3, 254) ‘Ciptakan Nilai Random Mulai 3 – 254
i = 0
‘Banyak Pengiriman Event Keyboard Random Setiap Kali Ketik…
Do While LoopC > i
‘Kirim Event Keyboard Secara Random Biar Mengacaukan Nilai Yang Ditangkap Keylogger
Call keybd_event(VkKeyScan(RandomNumber(32, 126)), 0, 0, 0)
i = i + 1
Loop
DoEvents ‘Kasih kesempatan program lain bekerja :)
TxtPassword.Locked = False
End Sub
‘<- END CODE ->’
Jalankan… kamu akan melihat tampilannya sbb:
Gbr. 1. Aplikasi Anti Pemantauan Keylogger
Silahkan melakukan percobaan dng keylogger. Oh, iya aku mendownload dari salah satu situs contoh keylogger sederhana yang bisa kamu download juga bersama-sama semua yang menyangkut artikel ini. Contoh output yg dihasilkan adalah
Gbr. 2. Aplikasi Keylogger dengan hasil pantauannya.
Dari sini kamu dapat melihat, pada aplikasi buatan kita (gbr. 1) aku menginput hanya 3 karakter saja. Namun, anehnya si keylogger (gbr. 2) memberi hasil pantauan yg lebih dar 3 karakter. Nah, aku rasa kamu sudah ngerti kali algoritma dari source code diatas. Yup!! Tepat sekali, sebenarnya bukan si keyloggernya yg salah tapi memang kita sengaja mengakali agar keylogger menangkap event keyboard yg sebenarnya tidak kita buat tapi dilakukan oleh program dan event keyboard ini tidak dikeluarkan pada posisi blink text melainkan di memory yang akan dimanfaatkan program yang menggunakannya dalam kasus ini keylogger tsb, artinya dia terjebak!!!…. hmmm bingung yah…
Begini, misalkan passwordku adalah “IDA”, dan akan kuisi ke form input aplikasi (gbr. 1). Pertama-tama saat aku menekan huruf “I” pada keyboard. keylogger akan menerima output huruf yang kita ketik ditambah huruf ketikan yg dikirim oleh program yg kita buat dng bentuk dan jumlah yg acak (random). Begitu pula saat aku ketik huruf berikutnya yaitu “D”, dan seterusnya. Lihat rumus berikut :
Output Keylogger = (Satu Karakter yg diketik) + (Karakter yang diciptakan program aplikasi secara acak X Nilai Acak)
X = Dikali / Sebanyak
Kalo dah begini… Pastinya, si penanam keylogger akan kebingungan melihat hasil pantauan yg diberikan keylogger. huehueheueheue.. biar kapok tuh para orang iseng yg memanfaatkan keylogger tuk curi-curi hak orang…. wueeekkk…
Akhir kata mungkin artikel ini belum cukup juga menjelaskan tentang keamanan yg menyangkut keylogger ini. Yah, saran aku sih belajar-belajarlah. Soalnya k’lo cuma dibaca doang, trus nggak dikembangin wah… sama aja aku ngasih biji tapi kamu letakin di tanah yg kering. Percuma khan… Aku pengen temen-temen pada jago-jago semua. Walaupun nih artikel terlalu kekanak-kanakan.. hiks…
Penutup, aku mo bilang makasih nih untuk semua yg ngedukung aku yaitu :
Buat Ibuku yang kucinta, salam sayang Ibu :)
Kakak… Tunggul Joh Genesis Tampubolon, sukses buat kerjaannya.
Adikku Torkis A. T, Torang B. T., Tumpal C. T., Timbul D. T., dan Trendy H. T salam hanagat dari sini buat Medan :).
Temen2 di Medan anak2 SMU Markus, Bandku, temen2 rumah & tetangga salam damai…
Temen di internet antara lain:
Bang DoS [ZoelSepur] pendiri Indohacking, dan rekan-rekannya TH1, pendekar, rockemon dll.
Anggota 1r15… An|Vie, Djum_Put_Cok, NemesisByte dan lainnya.
Temen di xcode ^family_code^, dan rekan lainnya yang nicknya rada-rada susah diungkapkan.. sorri.. piece ajah..
Buat siapa aja deh, salam kenal ajah dan salam damai oke…

contoh aplikasi menggunakan visual basic 6(Koneksi Internet)

Cek Koneksi Internat contoh aplikasi menggunakan visual basic 6
Cek Koneksi Internat (On/Off), Cek IP Adress, Cek Hostname
Sekarang kita mencoba membuat aplikasi yang berfungsi untuk mengetahui Status Kmputer terhubung dengan Internet atau tidak, Mengetahui IP Adress saat tidak terhubung dengan internet dan IP Adress saat terhubung dengan Internet Serta mengetahui IP Host Name. Untuk Lebih jelasnya dapat anda perhatikan kedua gambar di bawah ini yaitu Gambar aplikasi saat komputer tidak terhubung dengan internet (IP Adress otomatis 127.0.0.1) dan Gambar aplikasi saat terhubung dengan internet maka IP Adress komputer berubah menjadi 10.242.39.122 dan pada waktu yang lain ternyata IP Adress komputer berubah kembali menjadi
Berikut ini adalah Source codenya. Langsung saja yang dibutuhkan dalam pembuatan aplikasi ini adalah :
- 2 label dengan property name LblCekMyIP1 dan LblCekMyIP2
– 1 timer dengan property name Timer1, iNTERVAL = 1000
– Winsock1, untuk menambahkan Winsock1 pada toolbox maka dengan cara klik kanan pada toolbox pilih component dan centang microsoft winsock control 6.0
– status bar dengan property name SB, untuk menambahkan status bar pada toolbox caranya sama dengan winsock tetapi pilih windows common controls 6.0(sp6) Kemudian setelah status bar ditambahkan dalam form maka klik kanan status bar tersebut pilih property dan pada tab panel pilih angka 2 pada textbox Autosize.
– 1 modul untuk source code cek koneksi internet dan ip adress/Host name- 1 form
Semoga bermanfaat, terimakasih.
========================================
‘COPY PASTEKAN KODE DI BAWAH INI PADA FORM
========================================
Private Sub Form_Load()
Timer1.Enabled = True
LblCekMyIP1 = “IP Host Name: ” & GetIPHostName
LblCekMyIP2 = “IP Address: ” & GetIPAddress()
End Sub
Private Sub Timer1_Timer()
If InternetGetConnectedState(0&, 0&) = 1 Then
SB.Panels(1).Text = “Status: Terhubung dengan Internet”
Else
SB.Panels(1).Text = “Status: Tidak terhubung dengan Internet”
End If
End Sub
=============================
Letakkan code di bawah Ini pada Modul
=============================
‘cek koneksi internet
Public Declare Function Internet
GetConnectedState Lib “wininet.dll” (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
‘———CEK IP Adress komputer dan HOST NAME—–
Public Const MAX_WSADescription = 256Public Const MAX_WSASYSStatus = 128′
Public Const ERROR_SUCCESS As Long = 0
Public Const WS_VERSION_REQD As Long = &H101
Public Const WS_VERSION_MAJOR As Long = WS_VERSION_REQD \ &H100 And &HFF&
Public Const WS_VERSION_MINOR As Long = WS_VERSION_REQD And &HFF&
Public Const MIN_SOCKETS_REQD As Long = 1Public Const SOCKET_ERROR As Long = -1
Public Type HostenthName As LonghAliases As LonghAddrType As IntegerhLen As IntegerhAddrList As Long
End Type
Public Type WSADATAwversion As IntegerwHighVersion As IntegerszDescription(0 To MAX_WSADescription) As ByteszSystemStatus(0 To MAX_WSASYSStatus) As BytewMaxSockets As IntegerwMaxUDPDG As IntegerdwVendorInfo As Long
End Type
Public Declare Function WSAGetlastError Lib “wsock32.dll” () As Long
Public Declare Function WSAStartup Lib “wsock32.dll” (ByVal wVersionRequired As Long, lpWSAdata As WSADATA) As Long
Public Declare Function WSACleanup Lib “wsock32.dll” () As Long
Public Declare Function gethostname Lib “wsock32.dll” (ByVal szHost As String, ByVal dwHostLen As Long) As Long
Public Declare Function GetHostByName Lib “wsock32.dll” Alias “gethostbyname” (ByVal szHost As String) As Long
Public Declare Sub CopyMemory Lib “kernel32″ Alias “RtlMoveMemory” (hpvdest As Any, ByVal hpvSource As Long, ByVal cbCopy As Long)
Public Function GetIPAddress() As String
Dim sHostName As String * 256
Dim lpHost As Long
Dim HOST As Hostent
Dim dwIPAddr As Long
Dim tmpIPAddr() As Byte
Dim i As Integer
Dim sIPAddr As String
If Not SocketsInitialize() Then
GetIPAddress = “”
Exit Function
End If
If gethostname(sHostName, 256) = SOCKET_ERROR Then
GetIPAddress = “”MsgBox “Windows Sockets Error ” & Str$(WSAGetlastError()) & ” has occurred. Host Name tidak dapat ditampilkan.”SocketsCleanup
Exit Function
End If
sHostName = Trim$(sHostName)
lpHost = GetHostByName(sHostName)
If lpHost = 0 Then
GetIPAddress = “” MsgBox “Socket Windows tidak memberikan respon. ” & “Host Name tidak dapat ditampilkan.” SocketsCleanup
Exit Function
End If
CopyMemory HOST, lpHost, Len(HOST)CopyMemory dwIPAddr, HOST.hAddrList, 4ReDim tmpIPAddr(1 To HOST.hLen)CopyMemory tmpIPAddr(1), dwIPAddr, HOST.hLenFor i = 1 To HOST.hLensIPAddr = sIPAddr & tmpIPAddr(i) & “.”NextGetIPAddress = Mid$(sIPAddr, 1, Len(sIPAddr) – 1)SocketsCleanup
End Function
Public Function GetIPHostName() As StringDim sHostName As String * 256If Not SocketsInitialize() ThenGetIPHostName = “”
Exit Function
End If
If gethostname(sHostName, 256) = SOCKET_ERROR ThenGetIPHostName = “”MsgBox “Windows Sockets Error ” & Str$(WSAGetlastError()) & ” has occurred. Host Name tidak dapat ditampilkan.”SocketsCleanup
Exit Function
End IfGetIPHostName = Left$(sHostName, InStr(sHostName, Chr(0)) – 1)SocketsCleanup
End Function
Public Function HiByte(ByVal wParam As Integer)HiByte = wParam \ &H100 And &HFF&
End Function
Public Function LoByte(ByVal wParam As Integer)LoByte = wParam And &HFF&
End Function
Public Sub SocketsCleanup() If WSACleanup() <> error_success_ Then MsgBox ” Socket Error terjadi dalam CleanUp.”
End If
End Sub
Public Function SocketsInitialize() As Boolean
Dim WSAD As WSADATA
Dim sLoByte As String
Dim sHiByte As StringIf WSAStartup(WS_VERSION_REQD, WSAD) <> ERROR_SUCCESS ThenMsgBox “Socket Windows 32-bit tidak respon”SocketsInitialize = False
Exit Function
End If
If WSAD.wMaxSockets = MIN_SOCKETS_REQD Then MsgBox “Aplikasi ini membutuhkan minimum ” & CStr(MIN_SOCKETS_REQD) & ” Socket yang support.” SocketsInitialize = False
Exit Function
End If
If LoByte(WSAD.wversion) < shibyte =” CStr(HiByte(WSAD.wversion))” slobyte =” CStr(LoByte(WSAD.wversion))MsgBox” socketsinitialize =” False”>
Exit Function
End If SocketsInitialize = True
End Function
Semoga bermanfaat.