Showing posts with label vb.net. Show all posts
Showing posts with label vb.net. Show all posts

Monday 26 October 2015

VB.NET :: Menampilkan Web Camera dengan VB.NET (Pemrograman Visual Basic .NET)


Pertama buka Visual Studio 2008, kemudian Create VB.NET Project. Pada Form1 Tambahkan ListBox1 dan PictureBox1 sehingga tampak sebagai berikut :




Buka Source Code, tambahkan deklarasi berikut : (Untuk memanggil fungsi-fungsi Windows API yang dibutuhkan)

Imports System.Runtime.InteropServices


Public Class Form1


    Const WM_CAP_START = &H400S
    Const WS_CHILD = &H40000000
    Const WS_VISIBLE = &H10000000


    Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
    Const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11
    Const WM_CAP_EDIT_COPY = WM_CAP_START + 30
    Const WM_CAP_SEQUENCE = WM_CAP_START + 62
    Const WM_CAP_FILE_SAVEAS = WM_CAP_START + 23


    Const WM_CAP_SET_SCALE = WM_CAP_START + 53
    Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52
    Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50


    Const SWP_NOMOVE = &H2S
    Const SWP_NOSIZE = 1
    Const SWP_NOZORDER = &H4S
    Const HWND_BOTTOM = 1


    Declare Function capGetDriverDescriptionA Lib "avicap32.dll" _
       (ByVal wDriverIndex As Short, _
        ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, _
        ByVal cbVer As Integer) As Boolean


    Declare Function capCreateCaptureWindowA Lib "avicap32.dll" _
       (ByVal lpszWindowName As String, ByVal dwStyle As Integer, _
        ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
        ByVal nHeight As Short, ByVal hWnd As Integer, _
        ByVal nID As Integer) As Integer


    Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
       (ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, _
       <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer


    Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" _
       (ByVal hwnd As Integer, _
        ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, _
        ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer


    Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean


    Dim VideoSource As Integer
    Dim hWnd As Integer

Kemudian klik dua kali pada Form tambahkan kode program berikut ini (untuk menampilkan daftar webcam yang tersedia sehingga bisa dipilih) :

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim DriverName As String = Space(80)
        Dim DriverVersion As String = Space(80)
        For i As Integer = 0 To 9
            If capGetDriverDescriptionA(i, DriverName, 80, DriverVersion, 80) Then
                ListBox1.Items.Add(DriverName.Trim)
            End If
        Next
    End Sub

Kemudian klik dua kali pada ListBox1 tambahkan kode program berikut ini (untuk mulai menyalakan Kamera dan menampilkannya di PictureBox1) :

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        SendMessage(hWnd, WM_CAP_DRIVER_DISCONNECT, VideoSource, 0)
        DestroyWindow(hWnd)


        VideoSource = ListBox1.SelectedIndex


        hWnd = capCreateCaptureWindowA(VideoSource, WS_VISIBLE Or WS_CHILD, 0, 0, 0, _
            0, PictureBox1.Handle.ToInt32, 0)
        If SendMessage(hWnd, WM_CAP_DRIVER_CONNECT, VideoSource, 0) Then


            SendMessage(hWnd, WM_CAP_SET_SCALE, True, 0)


            SendMessage(hWnd, WM_CAP_SET_PREVIEWRATE, 30, 0)


            SendMessage(hWnd, WM_CAP_SET_PREVIEW, True, 0)


            SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, _
               PictureBox1.Width, PictureBox1.Height, _
               SWP_NOMOVE Or SWP_NOZORDER)
        Else


            DestroyWindow(hWnd)
        End If
    End Sub

Source Code selengkapnya :

Imports System.Runtime.InteropServices

Public Class Form1


    Const WM_CAP_START = &H400S
    Const WS_CHILD = &H40000000
    Const WS_VISIBLE = &H10000000


    Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
    Const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11
    Const WM_CAP_EDIT_COPY = WM_CAP_START + 30
    Const WM_CAP_SEQUENCE = WM_CAP_START + 62
    Const WM_CAP_FILE_SAVEAS = WM_CAP_START + 23


    Const WM_CAP_SET_SCALE = WM_CAP_START + 53
    Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52
    Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50


    Const SWP_NOMOVE = &H2S
    Const SWP_NOSIZE = 1
    Const SWP_NOZORDER = &H4S
    Const HWND_BOTTOM = 1


    Declare Function capGetDriverDescriptionA Lib "avicap32.dll" _
       (ByVal wDriverIndex As Short, _
        ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, _
        ByVal cbVer As Integer) As Boolean


    Declare Function capCreateCaptureWindowA Lib "avicap32.dll" _
       (ByVal lpszWindowName As String, ByVal dwStyle As Integer, _
        ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
        ByVal nHeight As Short, ByVal hWnd As Integer, _
        ByVal nID As Integer) As Integer


    Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
       (ByVal hwnd As Integer, ByVal Msg As Integer, ByVal wParam As Integer, _
       <MarshalAs(UnmanagedType.AsAny)> ByVal lParam As Object) As Integer


    Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" _
       (ByVal hwnd As Integer, _
        ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, _
        ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer


    Declare Function DestroyWindow Lib "user32" (ByVal hndw As Integer) As Boolean


    Dim VideoSource As Integer
    Dim hWnd As Integer


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim DriverName As String = Space(80)
        Dim DriverVersion As String = Space(80)
        For i As Integer = 0 To 9
            If capGetDriverDescriptionA(i, DriverName, 80, DriverVersion, 80) Then
                ListBox1.Items.Add(DriverName.Trim)
            End If
        Next
    End Sub


    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        SendMessage(hWnd, WM_CAP_DRIVER_DISCONNECT, VideoSource, 0)
        DestroyWindow(hWnd)


        VideoSource = ListBox1.SelectedIndex


        hWnd = capCreateCaptureWindowA(VideoSource, WS_VISIBLE Or WS_CHILD, 0, 0, 0, _
            0, PictureBox1.Handle.ToInt32, 0)
        If SendMessage(hWnd, WM_CAP_DRIVER_CONNECT, VideoSource, 0) Then


            SendMessage(hWnd, WM_CAP_SET_SCALE, True, 0)


            SendMessage(hWnd, WM_CAP_SET_PREVIEWRATE, 30, 0)


            SendMessage(hWnd, WM_CAP_SET_PREVIEW, True, 0)


            SetWindowPos(hWnd, HWND_BOTTOM, 0, 0, _
               PictureBox1.Width, PictureBox1.Height, _
               SWP_NOMOVE Or SWP_NOZORDER)
        Else


            DestroyWindow(hWnd)
        End If
    End Sub
End Class

Jika dijalankan Hasilnya :


Semoga berguna

Kode program dapat didownload disini (Setelah tampil di Google Docs, Untuk mendownload klik File-Download.)

Selanjutnya penulis akan sharing tentang aplikasi yang bisa Capture Foto dari WebCam dan berikutnya bisa Recording Video dari Kamera sehingga menjadi file Movie.

Monday 19 October 2015

VB.NET :: Program Visual Basic Net Simpan Edit Hapus Record Pada Database Access


Program Visual Basic Net Simpan Edit Hapus Record Pada Database Access
Berita Terkait
Menampilkan Record Ke ComboBox Dengan Visual Basic Net 2008
Menampilkan Record Ke ComboBox Dengan Visual Basic Net 2008
Pencarian Record Data Database Access Menggunakan Visual Basic Net 2008
Pencarian Record Data Database Access Menggunakan Visual Basic Net 2008
Program Edit dan Hapus Data Database Access Dengan VB Net
Program Edit dan Hapus Data Database Access Dengan VB Net
Program Tambah Record Di Visual Basic Net 2008
Program Tambah Record Di Visual Basic Net 2008
Program Koneksi Database Access Dari Visual Basic Net 2008
Program Koneksi Database Access Dari Visual Basic Net 2008
Sore yang panas ini saya tak lupa untuk membagikan sedikit ilmu pemrograman visual basic net.
Pada artikel program visual basic net simpan edit hapus record pada database accesssaya membahas kumpulan program yang terpisah pada artikel :
menjadi satu program utuh, sehingga anda tinggal menyimpan data, atau edit data, atau hapus data.
Program juga dilengkapi dengan beberapa perintah untuk memodifikasi button saat melakukan penyimpanan data, pengeditan ataupun penghapusan.
Silahkan buat dahulu database access :
Nama Database : SmartSolution.Mdb
Nama Table : Buku
Field
1. Kode type Text
2. Judul type Text
3. Pengarang type Text
4. Penerbit type Text
Design Form Program Visual Basic Net Simpan Edit Hapus Record Pada Database Access 
Program Visual Basic Net Simpan Edit Hapus Record Pada Database Access
Ketikkan listing program visual basic net simpan edit hapus record pada database access berikut
Imports System.Data.OleDb
Public Class Form1
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OpenDB()
Dim LOKASI = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source =E:DatabaseSmartSolution.mdb”
DB = New OleDbConnection(LOKASI)
If DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub TampilRecordBuku()
‘ PERINTAH SELEC TAMBAH HURUF T
ADP = New OleDbDataAdapter(“SELEC * FROM Buku”, DB)
DS = New DataSet
ADP.Fill(DS, “Buku”)
DataGridView1.DataSource = DS.Tables(“Buku”)
End Sub
Sub ButtonBaru()
btnBaru.Enabled = True
btnSimpan.Enabled = False
btnEdit.Enabled = False
btnHapus.Enabled = False
btnBatal.Enabled = False
btnkeluar.Enabled = True
End Sub
Sub ButtonEdit()
btnBaru.Enabled = False
btnSimpan.Enabled = False
btnEdit.Enabled = True
btnHapus.Enabled = True
btnBatal.Enabled = True
btnkeluar.Enabled = False
End Sub
Sub ButtonSimpan()
btnBaru.Enabled = False
btnSimpan.Enabled = True
btnEdit.Enabled = False
btnHapus.Enabled = False
btnBatal.Enabled = True
btnkeluar.Enabled = False
End Sub
Sub HapusText()
Judul.Text = “”
Kode.Text = “”
Pengarang.Text = “”
Penerbit.Text = “”
Call ButtonBaru()
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
Me.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call OpenDB()
Call HapusText()
Call TampilRecordBuku()
End Sub
Private Sub btnBaru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBaru.Click
Call HapusText()
Kode.Focus()
End Sub
Private Sub Kode_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Kode.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
Dim xkode As String
If tombol = 13 Then
‘ PERINTAH SELEC TAMBAH HURUF T
SQL = “SELEC * FROM BUKU Where Kode='” & Kode.Text & “‘”
CMD = New OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If DR.HasRows = True Then
Judul.Text = DR.Item(1)
Pengarang.Text = DR.Item(2)
Penerbit.Text = DR.Item(3)
Call ButtonEdit()
MsgBox(“Data ditemukan !”)
Else
xkode = Kode.Text
Call HapusText()
Kode.Text = xkode
Call ButtonSimpan()
End If
Judul.Focus()
End If
End Sub
Private Sub btnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBatal.Click
Call HapusText()
Kode.Focus()
End Sub
Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
SQL = “DELETE FROM BUKU Where Kode='” & Kode.Text & “‘”
CMD = New OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call btnBaru_Click(sender, e)
Call TampilRecordBuku()
End Sub
Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
SQL = “UPDATE Buku SET Judul='” & Judul.Text & “‘,” & _
” Pengarang='” & Pengarang.Text & “‘,” & _
” Penerbit='” & Penerbit.Text & “‘ ” & _
” Where Kode='” & Kode.Text & “‘”
CMD = New OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call btnBaru_Click(sender, e)
Call TampilRecordBuku()
End Sub
Private Sub btnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSimpan.Click
SQL = “INSERT INTO BUKU(kode, judul, pengarang, penerbit) ” & _
” values(‘” & Kode.Text & “‘,'” & _
Judul.Text & “‘,'” & _
Pengarang.Text & “‘,'” & _
Penerbit.Text & “‘)”
CMD = New OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call btnBaru_Click(sender, e)
Call TampilRecordBuku()
End Sub
End Class
Tag : Program Visual Basic Net Simpan Edit Hapus Record Pada Database Access, Belajar Bahasa Pemrograman, Bahasa Pemrograman Visual Basic Net, Tempat Download Program, program vb net

Bila bermanfaat silahkan share Program Visual Basic Net Simpan Edit Hapus Record Pada Database Access ini dengan teman anda, Terima kasih sebelumnya


Anda Harus Baca Artikel Ini

Tuesday 22 September 2015

VB.NET :: Source Code WebBrowser Berbasis Engine Mozilla Firefox





Source code ini bukan buatan saya. Jadi bisa sobat jadikan sebagai referensi jika ingin membuat browser sendiri yang lebih powerfull. Jika sobat memakai Visual Studio 2008 atau 2010 maka sobat harus mengkonvertnya terlebih dahulu. Karena source code ini dibuat memakai Visual Studio 2005

Fungsi utama yang ditonjolkan dalam source code browser ini adalah :

1. Fungsi menambah tab baru
2. Fungsi favicon pada situs yang dituju
3. Penambahan download manager
4. Dan penambahan fungsi lainnya

Semua fungsi basic maupun fungsi advanced semua ada di source code browser ini. Jadi bisa sobat pakai sebagai bahan pembelajaran agar nantinya bisa menciptakan sendiri sebuah browser yang handal

Untuk mencobanya silakan DOWNLOAD DISINI. Dan ciptakan kreasi anda sendiri

Saturday 19 September 2015

VB.NET :: APLIKASI PENCUCIAN KENDARAAN (VB.NET)

APLIKASI PENCUCIAN KENDARAAN (VB.NET)

APLIKASI PENCUCIAN KENDARAAN MENGGUNAKAN VB.NET












Aplikasi Pencucian Kendaraan ini dibuat menggunakan :
- Visual Studio 2005 / VB.Net 2005
- Dengan database MS.Access


Feature - Feature yang diberikan oleh aplikasi ini adalah :
- Splash Screen
- Menu Login
- Menu Utama
- Menu Master karyawan
- Menu Master pelanggan
- Menu Master pengguna
- Menu Transaksi Pembayaran Pencucian

Utility yang diberikan :
- Menu Manual Book
- Menu Log Off dan exit
- Menu ganti Password
- Menu Backup Database

Laporan - Laporan yang diberikan :
--laporan Data Master
--laporan Pencucian

Anda dapat memiliki aplikasi ini beserta source codenya untuk pembelajaran saja.
Anda dapat mengembangkan aplikasi yang telah jadi ini untuk menjadi lebih baik lagi sesuai dengan sistem yang anda buat. ini hanya sebuah gambaran saja seputar Rental Mobil.

Jika Anda Berminat Dengan Aplikasi ini, anda bisa menghubungi kami