Tampilkan postingan dengan label programming. Tampilkan semua postingan
Tampilkan postingan dengan label programming. Tampilkan semua postingan

Senin, 29 Agustus 2016

Program Rapor K13 (Kurikulum 2013) Terbaru Versi 01

Program rapor kurikulum 2013 terbaru ini memang sengaja saya buat untuk dapat digunakan oleh semua Sekolah yang ingin memakai program rapor kurikulum 2013 dengan mudah. Sengaja saya setting agar menu-menu yang berhubungan dengan identitas seperti nama sekolah, kepala sekolah, wali kelas, kota hingga mata pelajaran tidak saya proteksi, agar anda yang membutuhkan terutama bagi operator disekolah dapat langsung memakainya.

Meskipun demikian ada kalanya struktur mata pelajaran dan sebagainya mungkin tidak cocok dengan Sekolah anda, sehingga saya masih bisa membantu anda merubahkan bentuk formatnya (gratis) silakan hubungi kami, namun jika anda menginginkan untuk mengembangkannya silakan konsultasikan dengan kami.

Semoga program sederhana rapor kurikulum 2013 yang masih versi 01 ini dapat bermanfaat buat anda, sekolah anda dan terutama para wali kelas. Doakan saya selalu sehat agar dapat terus membantu anda dan memperbaharui rapor ini sesuai aturan yang berlaku. Terima kasih. Download Project:
Download Aplikasi Rapor K13 V.01
Lihat Video:
Readmore → Program Rapor K13 (Kurikulum 2013) Terbaru Versi 01

Rabu, 24 Agustus 2016

Create Simple Menu in Android Using Visual Studio

To create simple menu or navigation on android is easy. You must add few code something like this.
Add this code to mymenu.xml.
mymenu.xml code:
 
<?xml version="1.0" encoding="utf-8" ?> 
<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/home"
        android:title="Beranda"/>
  <item android:id="@+id/kategori"
        android:title="Kategori"/>
  <item android:id="@+id/setting"
        android:title="Setting"/>
</menu>

And then put this into your mainactivity.cs
Mainactivity.cs code:

using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

namespace Simple_Menu
{
   [Activity(Label = "Simple_Menu", MainLauncher = true, Icon = "@drawable/icon")]


   //Bagian utama
   public class MainActivity : Activity
   {
      //Buat menu
      public override bool OnCreateOptionsMenu(IMenu menu)
      {
         MenuInflater.Inflate(Resource.Menu.mymenu, menu);
         return base.OnCreateOptionsMenu(menu);
      }
      //Menu Kita di Klik
      public override bool OnOptionsItemSelected(IMenuItem item)
      {
         switch (item.ItemId)
         {
            case Resource.Id.home:
               Button Homeact = FindViewById<Button>(Resource.Id.MyButton);
               Homeact.Click += delegate { Homeact.Text = string.Format("{0} clicks!", count++); };
               //Kode aksi or Action code
               return true;
            case Resource.Id.kategori:
               //Kode aksi or Action code
               return true;
            case Resource.Id.setting:
               //Kode aksi or Action code
               return true;
         }

         return base.OnOptionsItemSelected(item);
      }

      int count = 1;
      protected override void OnCreate(Bundle bundle)
      {
         base.OnCreate(bundle);

         // Set our view from the "main" layout resource
         SetContentView(Resource.Layout.Main);

         // Get our button from the layout resource,
         // and attach an event to it
         Button button = FindViewById<Button>(Resource.Id.MyButton);

         button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
      }
   }
}

For complete tutorial you can download project or see the video below. Download Project:
Download Project
Lihat Video:
Readmore → Create Simple Menu in Android Using Visual Studio

Senin, 01 Agustus 2016

Source Code Game Puzzle Visual Basic

Berikut ini akan saya bagikan kepada Anda source code game puzzle sederhana menggunakan level yang ditulis dengan bahasa Visual Basic VB.NET. Source code beserta projectnya dapat anda download melalui link dibawah.

Kode Koneksi:

Imports System.Data.OleDb
Public Class koneksidata
    Dim conect As New OleDbConnection("provider = Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath.ToString & "\soni.mdb")
    Public Function open() As OleDbConnection
        Try
            conect.Open()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Return conect
    End Function
    Public Function close() As OleDbConnection
        Try
            conect.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Return conect
    End Function
End Class
Kode mnfrm:

Imports System.Data.OleDb
Namespace slidePuzzle
    Structure Block
        Public Row, Col As Integer
        Public Sub New(ByVal row As Integer, ByVal col As Integer)
            Me.Row = row
            Me.Col = col
        End Sub
    End Structure
    Public Class mnfrm
        Inherits System.Windows.Forms.Form
        Dim myconnection As New koneksidata
#Region "Kode Private"
        Const tSquare As Integer = 64
        Const tImageW As Integer = 62
        'Ukuran default
        Dim nRows As Integer = 2
        Dim nCols As Integer = 2
        Dim rand As Random
        Dim blankTile As Block
        Dim PictureLoaded As Boolean = False

        Dim timerCountdown As Integer
        Friend WithEvents tmplasttile As ctlTile
        Private tile(,) As ctlTile
        Friend WithEvents DariDataBase As MenuItem
        Friend WithEvents DariKomputer As MenuItem
        Friend WithEvents menuLoad As MenuItem
        Friend WithEvents menuShuffle As MenuItem
        Friend WithEvents menu2X2 As MenuItem
        Friend WithEvents menu3X3 As MenuItem
        Friend WithEvents menu4X4 As MenuItem
        Friend WithEvents menu5X5 As MenuItem
        Friend WithEvents menu6X6 As MenuItem
        Friend WithEvents menu7X7 As MenuItem
        Friend WithEvents menu8X8 As MenuItem
        Friend WithEvents menu9X9 As MenuItem
        Friend WithEvents menu10X10 As MenuItem
        Friend WithEvents menuSize As MenuItem
        Friend WithEvents MenuItem1 As MenuItem
        Friend WithEvents menuWhite As MenuItem
        Friend WithEvents menuGreen As MenuItem
        Friend WithEvents menuBlue As MenuItem
        Friend WithEvents menuRed As MenuItem
        Friend WithEvents menuSilver As MenuItem
        Friend WithEvents menuGridColor As MenuItem
        Friend WithEvents MenuItem2 As MenuItem
        Friend WithEvents mainMenu1 As MainMenu
        Friend WithEvents Konfigurasi As MenuItem
        Friend WithEvents openFile As System.Windows.Forms.OpenFileDialog
#End Region

#Region "Kode WinFormnya"
        Public Sub New()
            MyBase.New()
            InitializeComponent()
        End Sub
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub

        Private components As System.ComponentModel.IContainer
        Friend WithEvents tRandom As System.Windows.Forms.Timer
        Private WithEvents tilesPanel As System.Windows.Forms.Panel
         Private Sub InitializeComponent()
            Me.components = New System.ComponentModel.Container()
            Me.tilesPanel = New System.Windows.Forms.Panel()
            Me.openFile = New System.Windows.Forms.OpenFileDialog()
            Me.tRandom = New System.Windows.Forms.Timer(Me.components)
            Me.DariDataBase = New System.Windows.Forms.MenuItem()
            Me.DariKomputer = New System.Windows.Forms.MenuItem()
            Me.menuLoad = New System.Windows.Forms.MenuItem()
            Me.Konfigurasi = New System.Windows.Forms.MenuItem()
            Me.menuShuffle = New System.Windows.Forms.MenuItem()
            Me.menu2X2 = New System.Windows.Forms.MenuItem()
            Me.menu3X3 = New System.Windows.Forms.MenuItem()
            Me.menu4X4 = New System.Windows.Forms.MenuItem()
            Me.menu5X5 = New System.Windows.Forms.MenuItem()
            Me.menu6X6 = New System.Windows.Forms.MenuItem()
            Me.menu7X7 = New System.Windows.Forms.MenuItem()
            Me.menu8X8 = New System.Windows.Forms.MenuItem()
            Me.menu9X9 = New System.Windows.Forms.MenuItem()
            Me.menu10X10 = New System.Windows.Forms.MenuItem()
            Me.menuSize = New System.Windows.Forms.MenuItem()
            Me.MenuItem1 = New System.Windows.Forms.MenuItem()
            Me.menuWhite = New System.Windows.Forms.MenuItem()
            Me.menuGreen = New System.Windows.Forms.MenuItem()
            Me.menuBlue = New System.Windows.Forms.MenuItem()
            Me.menuRed = New System.Windows.Forms.MenuItem()
            Me.menuSilver = New System.Windows.Forms.MenuItem()
            Me.menuGridColor = New System.Windows.Forms.MenuItem()
            Me.MenuItem2 = New System.Windows.Forms.MenuItem()
            Me.mainMenu1 = New System.Windows.Forms.MainMenu(Me.components)
            Me.SuspendLayout()
            '
            'tilesPanel
            '
            Me.tilesPanel.BackColor = System.Drawing.Color.PaleGreen
            Me.tilesPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
            Me.tilesPanel.Location = New System.Drawing.Point(8, 12)
            Me.tilesPanel.Name = "tilesPanel"
            Me.tilesPanel.Size = New System.Drawing.Size(272, 224)
            Me.tilesPanel.TabIndex = 0
            '
            'tRandom
            '
            '
            'DariDataBase
            '
            Me.DariDataBase.Index = 0
            Me.DariDataBase.Text = "Dari Database (Otomatis)"
            '
            'DariKomputer
            '
            Me.DariKomputer.Index = 1
            Me.DariKomputer.Text = "Dari Komputer (Manual)"
            '
            'menuLoad
            '
            Me.menuLoad.Index = 0
            Me.menuLoad.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.DariDataBase, Me.DariKomputer, Me.Konfigurasi})
            Me.menuLoad.Text = "Gambar"
            '
            'Konfigurasi
            '
            Me.Konfigurasi.Index = 2
            Me.Konfigurasi.Text = "Konfigurasi"
            '
            'menuShuffle
            '
            Me.menuShuffle.Enabled = False
            Me.menuShuffle.Index = 1
            Me.menuShuffle.Text = "Acak"
            '
            'menu2X2
            '
            Me.menu2X2.DefaultItem = True
            Me.menu2X2.Index = 0
            Me.menu2X2.Text = "2 x 2"
            '
            'menu3X3
            '
            Me.menu3X3.Index = 1
            Me.menu3X3.RadioCheck = True
            Me.menu3X3.Text = "3 x 3"
            '
            'menu4X4
            '
            Me.menu4X4.Index = 2
            Me.menu4X4.RadioCheck = True
            Me.menu4X4.Text = "4 x 4"
            '
            'menu5X5
            '
            Me.menu5X5.Index = 3
            Me.menu5X5.RadioCheck = True
            Me.menu5X5.Text = "5 x 5"
            '
            'menu6X6
            '
            Me.menu6X6.Index = 4
            Me.menu6X6.Text = "6 x 6"
            '
            'menu7X7
            '
            Me.menu7X7.Index = 5
            Me.menu7X7.Text = "7 x 7"
            '
            'menu8X8
            '
            Me.menu8X8.Index = 6
            Me.menu8X8.Text = "8 x 8"
            '
            'menu9X9
            '
            Me.menu9X9.Index = 7
            Me.menu9X9.Text = "9 x 9"
            '
            'menu10X10
            '
            Me.menu10X10.Index = 8
            Me.menu10X10.Text = "10 x 10"
            '
            'menuSize
            '
            Me.menuSize.Index = 2
            Me.menuSize.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menu2X2, Me.menu3X3, Me.menu4X4, Me.menu5X5, Me.menu6X6, Me.menu7X7, Me.menu8X8, Me.menu9X9, Me.menu10X10})
            Me.menuSize.RadioCheck = True
            Me.menuSize.Text = "Ukuran"
            '
            'MenuItem1
            '
            Me.MenuItem1.Index = 4
            Me.MenuItem1.Text = ""
            '
            'menuWhite
            '
            Me.menuWhite.Index = 0
            Me.menuWhite.Text = "White"
            '
            'menuGreen
            '
            Me.menuGreen.Checked = True
            Me.menuGreen.DefaultItem = True
            Me.menuGreen.Index = 1
            Me.menuGreen.Text = "Green"
            '
            'menuBlue
            '
            Me.menuBlue.Index = 2
            Me.menuBlue.Text = "Blue"
            '
            'menuRed
            '
            Me.menuRed.Index = 3
            Me.menuRed.Text = "Red"
            '
            'menuSilver
            '
            Me.menuSilver.Index = 4
            Me.menuSilver.Text = "Silver"
            '
            'menuGridColor
            '
            Me.menuGridColor.Index = 3
            Me.menuGridColor.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuWhite, Me.menuGreen, Me.menuBlue, Me.menuRed, Me.menuSilver})
            Me.menuGridColor.Text = "Warna"
            '
            'MenuItem2
            '
            Me.MenuItem2.Index = 5
            Me.MenuItem2.Text = ""
            '
            'mainMenu1
            '
            Me.mainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuLoad, Me.menuShuffle, Me.menuSize, Me.menuGridColor, Me.MenuItem1, Me.MenuItem2})
            '
            'mnfrm
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(288, 401)
            Me.Controls.Add(Me.tilesPanel)
            Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
            Me.Icon = Global.slidePuzzle.My.Resources.Resources.ikonku
            Me.MaximizeBox = False
            Me.Menu = Me.mainMenu1
            Me.Name = "mnfrm"
            Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
            Me.Text = "D'Puzzle www.skyars.com"
            Me.ResumeLayout(False)

        End Sub
#End Region

#Region "Muat Form"
        Private Sub mnfrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            MakeTiles(nRows, nCols)
            menuSize.Enabled = False
            menuGridColor.Enabled = False
        End Sub
#End Region

#Region "Acak dengan Waktu"
        Protected Sub Randomize()
            rand = New Random()
            timerCountdown = 64 * nRows * nCols
            tRandom.Interval = 1
            tRandom.Enabled = True
        End Sub
        Private Sub TimerOnTick(ByVal obj As Object, ByVal ea As EventArgs) Handles tRandom.Tick
            Dim col As Integer = blankTile.Col
            Dim row As Integer = blankTile.Row

            Select Case (rand.Next(4))
                Case 0 : col += 1
                Case 1 : col -= 1
                Case 2 : row += 1
                Case 3 : row -= 1
            End Select

            If (col >= 0 And col < nCols And row >= 0 And row < nRows) Then
                MoveTile(col, row)
            End If

            timerCountdown = timerCountdown - 1
            If (timerCountdown = 0) Then
                tRandom.Stop()
            End If
        End Sub
#End Region

#Region "Pindahkan Tiles (int Col, Int Row)"
        Private Sub MoveTile(ByVal Col As Integer, ByVal Row As Integer)
            tile(Row, Col).Location = New Point(blankTile.Col * tSquare,
                       blankTile.Row * tSquare)

            tile(blankTile.Row, blankTile.Col) = tile(Row, Col)
            tile(Row, Col) = Nothing
            blankTile = New Block(Row, Col)
        End Sub
#End Region

#Region "Pindahkan Tiles (int Rows, int Cols)"
        Public Sub MakeTiles(ByVal Rows As Integer, ByVal Cols As Integer)
            Dim index As Integer = 0

            ReDim tile(Rows, Cols)
            tilesPanel.Size = New Size(tSquare * Rows + 4, tSquare * Cols + 4)
            tilesPanel.Location = New Point(4, 4)
            Me.ClientSize = New Size(tilesPanel.Size.Width + 6, tilesPanel.Size.Height + 6)

            Dim Row, Col As Integer
            For Row = 0 To Rows - 1
                For Col = 0 To Cols - 1
                    tile(Row, Col) = New ctlTile(tSquare, tSquare, index)
                    tile(Row, Col).Parent = Me.tilesPanel
                    tile(Row, Col).Location = New Point(Col * tSquare, Row * tSquare)
                    index += 1
                Next
            Next
        End Sub
#End Region

#Region "Keyboard dan Mouse"
        Private Sub mnfrm_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
            ' Cek puzzle sudah diacak atau belum
            If ((menuShuffle.Enabled) Or (PictureLoaded = False)) Then Return

            ' Arrow Keys Left
            If (e.KeyCode = Keys.Left And blankTile.Col < nCols - 1) Then
                MoveTile(blankTile.Col + 1, blankTile.Row)

                ' Arrow Keys Right
            ElseIf (e.KeyCode = Keys.Right And blankTile.Col > 0) Then
                MoveTile(blankTile.Col - 1, blankTile.Row)

                ' Arrow Keys Up
            ElseIf (e.KeyCode = Keys.Up And blankTile.Row < nRows - 1) Then
                MoveTile(blankTile.Col, blankTile.Row + 1)

                ' Arrow Keys Down
            ElseIf (e.KeyCode = Keys.Down And blankTile.Row > 0) Then
                MoveTile(blankTile.Col, blankTile.Row - 1)

            End If

            e.Handled = True
            CheckFinish()     'Cek jika puzzle dipecahkan.
        End Sub

        Private Sub tilesPanel_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles tilesPanel.MouseDown
            ' Cek puzzle sudah diacak atau belum
            If ((menuShuffle.Enabled) Or (PictureLoaded = False)) Then Return

            Dim Col As Integer = e.X \ tSquare  'pembagi integer
            Dim Row As Integer = e.Y \ tSquare  'pembagi integer

            If (Col = blankTile.Col) Then
                If (Row < blankTile.Row) Then
                    Dim Row2 As Integer
                    For Row2 = blankTile.Row - 1 To Row Step -1
                        MoveTile(Col, Row2)
                    Next

                ElseIf (Row > blankTile.Row) Then
                    Dim Row2 As Integer
                    For Row2 = blankTile.Row + 1 To Row
                        MoveTile(Col, Row2)
                    Next
                End If

            ElseIf (Row = blankTile.Row) Then
                If (Col < blankTile.Col) Then
                    Dim Col2 As Integer
                    For Col2 = blankTile.Col - 1 To Col Step -1
                        MoveTile(Col2, Row)
                    Next

                ElseIf (Col > blankTile.Col) Then
                    Dim Col2 As Integer
                    For Col2 = blankTile.Col + 1 To Col
                        MoveTile(Col2, Row)
                    Next
                End If
            End If

            CheckFinish() 'Cek jika puzzle benar :)
        End Sub
#End Region

#Region "Kode jika susunan benar dan menang"
        Private Sub CheckFinish()
            Dim Finished As Boolean = True

            Dim index As Integer = 0
            Dim Row, Col As Integer

            For Row = 0 To nRows - 1
                For Col = 0 To nCols - 1
                    If ((index <> nRows * nCols) And Not (tile(Row, Col) Is Nothing)) Then
                        Finished = Finished And (tile(Row, Col).tIndex = index)
                    End If
                    index += 1
                    If Not (Finished) Then Return
                Next
            Next

            If (Finished) Then
                tile(nRows - 1, nCols - 1) = tmplasttile
                tile(nRows - 1, nCols - 1).Visible = True
                Dim result As Integer = MessageBox.Show("Anda berhasil menyusunnya!!, Lanjut level selanjutnya?", "Selamat :)", MessageBoxButtons.YesNo)
                If result = DialogResult.No Then
                    blankTile = New Block(nRows - 1, nCols - 1)
                    clearItems()
                    MakeTiles(nRows, nCols)
                ElseIf result = DialogResult.Yes Then
                    If My.Settings.SLEVEL <= 9 Then
                        My.Settings.SLEVEL += 1
                        My.Settings.Save()
                        MessageBox.Show("Level, '" & My.Settings.SLEVEL & "'", "[Konfirmasi]")
                        blankTile = New Block(nRows - 1, nCols - 1)
                        clearItems()
                        Dim sonisitez As Integer = My.Settings.SLEVEL + 1
                        nRows = sonisitez
                        nCols = sonisitez
                        MakeTiles(nRows, nCols)
                        muat_dari_db()
                    Else
                        MsgBox("Anda sudah menyelesaikan seluruh level hehe :-D", MsgBoxStyle.Information, "Selamat :)")
                        blankTile = New Block(nRows - 1, nCols - 1)
                    End If

                End If
            End If
        End Sub
#End Region

#Region "Menunya"
        Private Sub menuShuffle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuShuffle.Click
            menuShuffle.Enabled = False
            menuGridColor.Enabled = True
            tmplasttile = tile(nRows - 1, nCols - 1)
            tmplasttile.Visible = False
            tile(nRows - 1, nCols - 1).Visible = False
            Randomize()
        End Sub
#End Region

#Region "Ukuran Menu"
        Private Sub menu2X2_Click(sender As Object, e As EventArgs) Handles menu2X2.Click
            If (menu2X2.Checked) Then Return
            clearItems()
            menu2X2.Checked = True
            nRows = 2
            nCols = 2
            MakeTiles(nRows, nCols)
        End Sub
        Private Sub menu3X3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menu3X3.Click
            If (menu3X3.Checked) Then Return
            clearItems()
            menu3X3.Checked = True
            nRows = 3
            nCols = 3
            MakeTiles(nRows, nCols)
        End Sub
        Private Sub menu4X4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menu4X4.Click
            If (menu4X4.Checked) Then Return
            clearItems()
            menu4X4.Checked = True
            nRows = 4
            nCols = 4
            MakeTiles(nRows, nCols)
        End Sub
        Private Sub menu5X5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menu5X5.Click
            If (menu5X5.Checked) Then Return
            clearItems()
            menu5X5.Checked = True
            nRows = 5
            nCols = 5
            MakeTiles(nRows, nCols)
        End Sub

        Private Sub menu6X6_Click(sender As Object, e As EventArgs) Handles menu6X6.Click
            If (menu6X6.Checked) Then Return
            clearItems()
            menu6X6.Checked = True
            nRows = 6
            nCols = 6
            MakeTiles(nRows, nCols)
        End Sub

        Private Sub menu7X7_Click(sender As Object, e As EventArgs) Handles menu7X7.Click
            If (menu7X7.Checked) Then Return
            clearItems()
            menu7X7.Checked = True
            nRows = 7
            nCols = 7
            MakeTiles(nRows, nCols)
        End Sub

        Private Sub menu8X8_Click(sender As Object, e As EventArgs) Handles menu8X8.Click
            If (menu8X8.Checked) Then Return
            clearItems()
            menu8X8.Checked = True
            nRows = 8
            nCols = 8
            MakeTiles(nRows, nCols)
        End Sub

        Private Sub menu9X9_Click(sender As Object, e As EventArgs) Handles menu9X9.Click
            If (menu9X9.Checked) Then Return
            clearItems()
            menu9X9.Checked = True
            nRows = 9
            nCols = 9
            MakeTiles(nRows, nCols)
        End Sub

        Private Sub menu10X10_Click(sender As Object, e As EventArgs) Handles menu10X10.Click
            If (menu10X10.Checked) Then Return
            clearItems()
            menu10X10.Checked = True
            nRows = 10
            nCols = 10
            MakeTiles(nRows, nCols)
        End Sub
        Private Sub clearItems()
            menu2X2.Checked = False
            menu3X3.Checked = False
            menu4X4.Checked = False
            menu5X5.Checked = False
            menu6X6.Checked = False
            menu7X7.Checked = False
            menu8X8.Checked = False
            menu9X9.Checked = False
            menu10X10.Checked = False
            Dim Row, Col As Integer
            For Row = 0 To nRows - 1
                For Col = 0 To nCols - 1
                    Try
                        tile(Row, Col).Dispose()
                    Catch
                        '
                    End Try
                Next
            Next
            menuShuffle.Enabled = False
            menuGridColor.Enabled = True
            PictureLoaded = False
        End Sub

#End Region

#Region "Warna Grid"
        Private Sub ClearColors()
            menuWhite.Checked = False
            menuGreen.Checked = False
            menuBlue.Checked = False
            menuRed.Checked = False
            menuSilver.Checked = False
        End Sub

        Private Sub menuWhite_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuWhite.Click
            ClearColors()
            menuWhite.Checked = True
            Me.tilesPanel.BackColor = Color.LightYellow
        End Sub

        Private Sub menuGreen_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuGreen.Click
            ClearColors()
            menuGreen.Checked = True
            Me.tilesPanel.BackColor = Color.PaleGreen
        End Sub

        Private Sub menuBlue_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuBlue.Click
            ClearColors()
            menuBlue.Checked = True
            Me.tilesPanel.BackColor = Color.LightBlue
        End Sub

        Private Sub menuRed_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuRed.Click
            ClearColors()
            menuRed.Checked = True
            Me.tilesPanel.BackColor = Color.LightCoral
        End Sub

        Private Sub menuSilver_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles menuSilver.Click
            ClearColors()
            menuSilver.Checked = True
            Me.tilesPanel.BackColor = Color.Silver
        End Sub
#End Region
        Private Sub DariKomputer_Click(sender As Object, e As EventArgs) Handles DariKomputer.Click
            openFile.FileName = ""
            openFile.Filter = "Gambar (*.jpg,*.jpeg,*.png,*.bmp,*.gif,*.tiff)|*.jpg;*.jpeg;*.png;*.bmp;*.gif;*.tiff"
            openFile.ShowDialog()
            If (openFile.FileName = "") Then
                menuShuffle.Enabled = False
                menuGridColor.Enabled = True
                Return
            End If

            Dim Row, Col As Integer
            For Row = 0 To nRows - 1
                For Col = 0 To nCols - 1
                    Try
                        tile(Row, Col).Dispose()
                    Catch
                    End Try
                Next
            Next

            MakeTiles(nRows, nCols)

            Dim cxThumbnail As Integer = tImageW * nRows
            Dim cyThumbnail As Integer = tImageW * nRows

            Dim Pic As Image = Image.FromFile(openFile.FileName)
            Pic = Pic.GetThumbnailImage(cxThumbnail, cyThumbnail, Nothing, System.IntPtr.Zero)

            Console.WriteLine(tile(0, 0).Location)
            For Row = 0 To nRows - 1
                For Col = 0 To nCols - 1
                    tile(Row, Col).tilePicture(Pic, New Point(Col * tImageW, Row * tImageW))
                Next
            Next

            blankTile = New Block(nRows - 1, nCols - 1)
            menuShuffle.Enabled = True
            PictureLoaded = True
            If menuSize.Enabled = False Then
                menuSize.Enabled = True
            End If
            If menuGridColor.Enabled = False Then
                menuGridColor.Enabled = True
            End If
        End Sub
        Sub muat_dari_db()
            Try
                Using sql As New OleDbCommand("select gambar from tbsoni where level='" & Replace(My.Settings.SLEVEL, "'", "''") & "'", myconnection.open)
                    Using dr As OleDbDataReader = sql.ExecuteReader()
                        Using dt As New DataTable
                            dt.Load(dr)
                            If dt.Rows.Count <> 1 Then
                            Else
                                Dim rowsoni As DataRow = dt.Rows(0)
                                Using ms As New IO.MemoryStream(CType(rowsoni(0), Byte()))
                                    Dim Row, Col As Integer
                                    For Row = 0 To nRows - 1
                                        For Col = 0 To nCols - 1
                                            Try
                                                tile(Row, Col).Dispose()
                                            Catch
                                            End Try
                                        Next
                                    Next
                                    MakeTiles(nRows, nCols)
                                    Dim cxThumbnail As Integer = tImageW * nRows
                                    Dim cyThumbnail As Integer = tImageW * nRows
                                    'Dim Pic As Image = Image.FromFile(openFile.FileName)
                                    Dim Pic As Image = Image.FromStream(ms)
                                    Pic = Pic.GetThumbnailImage(cxThumbnail, cyThumbnail, Nothing, System.IntPtr.Zero)
                                    Console.WriteLine(tile(0, 0).Location)
                                    For Row = 0 To nRows - 1
                                        For Col = 0 To nCols - 1
                                            tile(Row, Col).tilePicture(Pic, New Point(Col * tImageW, Row * tImageW))
                                        Next
                                    Next
                                    blankTile = New Block(nRows - 1, nCols - 1)
                                    ''If My.Settings.LEVELSONI <= 1 Then
                                    ''Else
                                    ''    clearItems()
                                    ''    Dim sonisitez As Integer = My.Settings.LEVELSONI
                                    ''    nRows = sonisitez
                                    ''    nCols = sonisitez
                                    ''    MakeTiles(nRows, nCols)
                                    ''End If
                                    menuShuffle.Enabled = True
                                    If menuGridColor.Enabled = False Then
                                        menuGridColor.Enabled = True
                                    End If
                                    If menuSize.Enabled = True Then
                                        menuSize.Enabled = False
                                    End If
                                    PictureLoaded = True
                                End Using
                            End If
                        End Using
                    End Using
                End Using
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            myconnection.close()
        End Sub
        Private Sub DariDataBase_Click(sender As Object, e As EventArgs) Handles DariDataBase.Click
            muat_dari_db()
        End Sub
        Private Sub Konfigurasi_Click(sender As Object, e As EventArgs) Handles Konfigurasi.Click
            FormKonfigurasi.Show()
        End Sub
        Private Sub mnfrm_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
            My.Settings.LEVELSONI = My.Settings.SLEVEL
            My.Settings.Save()
        End Sub
    End Class
End Namespace
Kode Tile:

Namespace slidePuzzle
    Public Class ctlTile
        Inherits System.Windows.Forms.UserControl

#Region "Private filds"
        Private imagePoint As Point
        Friend WithEvents imageBase As System.Windows.Forms.Button
        Friend WithEvents tilePic As System.Windows.Forms.PictureBox
        Private t_index As Integer
#End Region

#Region "Public Properties"
        Public ReadOnly Property tIndex() As Integer
            Get
                Return t_index
            End Get
        End Property

        Public ReadOnly Property tImageSize() As Size
            Get
                Return Me.tilePic.Size
            End Get
        End Property
#End Region

        Private components As System.ComponentModel.Container = Nothing

#Region "Contructor and Dispose"
        Public Sub New(ByVal tWidth As Integer, ByVal tHeight As Integer, ByVal index As Integer)

            MyBase.New()
            'Tile's Index
            t_index = index

            'Disable control so parent form cann handle its key and mouse
            'events
            Enabled = False

            ' This call is required by the Windows.Forms Form Designer.
            InitializeComponent()

            'Image Base and Imgae Fixation Here
            If ((tWidth < 32 Or tWidth > 96) Or (tHeight < 32 Or tHeight > 96)) Then
                Me.Size = New Size(64, 64)
                tWidth = 64
                tHeight = 64
            Else
                Me.Size = New Size(tWidth, tHeight)
            End If

            imageBase.Location = New Point(0, 0)
            imageBase.Size = New Size(tWidth, tHeight)
            tilePic.Location = New Point(1, 1)
            tilePic.Size = New Size(tWidth - 2, tHeight - 2)
            tilePic.Image = Nothing
        End Sub

        ' Clean up any resources being used.
        Protected Overloads Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub

#End Region

#Region "Component Designer generated code"
        ' Required method for Designer support - do not modify 
        ' the contents of this method with the code editor.
         Private Sub InitializeComponent()
            Me.imageBase = New System.Windows.Forms.Button()
            Me.tilePic = New System.Windows.Forms.PictureBox()
            CType(Me.tilePic, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'imageBase
            '
            Me.imageBase.BackColor = System.Drawing.Color.DarkOliveGreen
            Me.imageBase.Enabled = False
            Me.imageBase.FlatStyle = System.Windows.Forms.FlatStyle.System
            Me.imageBase.Location = New System.Drawing.Point(1, 1)
            Me.imageBase.Name = "imageBase"
            Me.imageBase.Size = New System.Drawing.Size(62, 62)
            Me.imageBase.TabIndex = 0
            Me.imageBase.UseVisualStyleBackColor = False
            '
            'tilePic
            '
            Me.tilePic.BackColor = System.Drawing.Color.OliveDrab
            Me.tilePic.Location = New System.Drawing.Point(2, 2)
            Me.tilePic.Name = "tilePic"
            Me.tilePic.Size = New System.Drawing.Size(60, 60)
            Me.tilePic.TabIndex = 1
            Me.tilePic.TabStop = False
            '
            'ctlTile
            '
            Me.Controls.Add(Me.tilePic)
            Me.Controls.Add(Me.imageBase)
            Me.Name = "ctlTile"
            Me.Size = New System.Drawing.Size(64, 64)
            CType(Me.tilePic, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)

        End Sub
#End Region

#Region "Tile Picture"
        Public Sub tilePicture(ByVal tImage As Image, ByVal StartPt As Point)
            tilePic.Image = tImage
            imagePoint = StartPt
        End Sub
#End Region

#Region "Repaint Tile"
        Private Sub TilePic_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles tilePic.Paint
            If Not (tilePic.Image Is Nothing) Then
                Dim g As Graphics = e.Graphics
                g.DrawImage(tilePic.Image, New Rectangle(New Point(0, 0), New Size(tilePic.Width, tilePic.Height)),
                 New Rectangle(imagePoint, New Size(tilePic.Width, tilePic.Height)), GraphicsUnit.Pixel)
            End If
        End Sub

        Private Sub tilePic_Click(sender As Object, e As EventArgs) Handles tilePic.Click

        End Sub
#End Region
    End Class
End Namespace
Kode Konfigurasi:

Imports System.Data.OleDb
Public Class FormKonfigurasi
    Dim myconnection As New koneksidata
    Dim mycmd As New OleDbCommand
    Dim objadapter As OleDbDataAdapter
    Dim objreader As OleDbDataReader
    Dim dtable As New DataTable
#Region "konfigurasi"
    Dim a As New OpenFileDialog
    Sub bukadialogfoto()
        Dim PictureLocation As String
        a.Filter = "Gambar (*.jpg,*.jpeg,*.png,*.bmp,*.gif,*.tiff)|*.jpg;*.jpeg;*.png;*.bmp;*.gif;*.tiff"
        PictureLocation = a.FileName
        Try
            If a.ShowDialog = Windows.Forms.DialogResult.OK Then
                PictureBox1.Image = New Bitmap(a.FileName)
                PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
            End If
        Catch ex As Exception
            Exit Sub
        End Try
    End Sub
    Sub simpanfoto()
        Try
            myconnection.close()
            Using sql As New OleDbCommand("insert into tbsoni values('" & CLEVEL.Text & "',@gambar)", myconnection.open)
                If a.FileName = Nothing Then
                    'sql.Parameters.Add(New OleDbParameter("@FOTO", OleDbType.Binary)).Value = IO.File.ReadAllBytes("kosong.jpg")
                    MsgBox("Anda belum memilih gambar !!", MsgBoxStyle.Information, "Pemberitahuan !!")
                Else
                    sql.Parameters.Add(New OleDbParameter("@gambar", OleDbType.Binary)).Value = IO.File.ReadAllBytes(a.FileName)
                    MsgBox("Gambar level:  '" & CLEVEL.Text & "'  berhasil disimpan !!", MsgBoxStyle.Information, "Pemberitahuan !!")
                End If
                sql.ExecuteNonQuery()
            End Using
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        myconnection.close()
    End Sub
    Sub ubahfoto()
        Try
            myconnection.close()
            Using sql As New OleDbCommand("update tbsoni set gambar=@gambar where level='" & CLEVEL.Text & "'", myconnection.open)
                If a.FileName = Nothing Then
                    'sql.Parameters.Add(New OleDbParameter("@FOTO", OleDbType.Binary)).Value = IO.File.ReadAllBytes("kosong.jpg")
                    MsgBox("Anda belum memilih gambar !!", MsgBoxStyle.Information, "Pemberitahuan !!")
                Else
                    sql.Parameters.Add(New OleDbParameter("@gambar", OleDbType.Binary)).Value = IO.File.ReadAllBytes(a.FileName)
                    MsgBox("Gambar level:  '" & CLEVEL.Text & "'  berhasil dirubah !!", MsgBoxStyle.Information, "Pemberitahuan !!")
                End If
                sql.ExecuteNonQuery()
            End Using
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        myconnection.close()
    End Sub
#End Region
    Private Sub BTSIMPAN_Click(sender As Object, e As EventArgs) Handles BTSIMPAN.Click
        Try
            Using sql As New OleDbCommand("select gambar from tbsoni where level = '" & Replace(CLEVEL.Text, "'", "''") & "'", myconnection.open)
                Using dr As OleDbDataReader = sql.ExecuteReader()
                    Using dt As New DataTable
                        dt.Load(dr)
                        If CLEVEL.Text = "" Then
                            MsgBox("Anda belum memilih level !!", MsgBoxStyle.Exclamation, "Pemberitahuan !!")
                        ElseIf dt.Rows.Count <> 1 Then
                            simpanfoto()
                        Else
                            ubahfoto()
                        End If
                    End Using
                End Using
            End Using
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        myconnection.close()
    End Sub
    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
        bukadialogfoto()
    End Sub
    Private Sub CLEVEL_KeyPress(sender As Object, e As KeyPressEventArgs) Handles CLEVEL.KeyPress
        e.KeyChar = Chr(0)
    End Sub

    Private Sub BTRESETLEVEL_Click(sender As Object, e As EventArgs) Handles BTRESETLEVEL.Click
        My.Settings.SLEVEL = 1
        My.Settings.Save()
    End Sub
    Private Sub CLEVEL_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CLEVEL.SelectedIndexChanged
        Try
            Using sql As New OleDbCommand("select gambar from tbsoni where level='" & Replace(CLEVEL.Text, "'", "''") & "'", myconnection.open)
                Using dr As OleDbDataReader = sql.ExecuteReader()
                    Using dt As New DataTable
                        dt.Load(dr)
                        If dt.Rows.Count <> 1 Then
                            PictureBox1.Image = Nothing
                        Else
                            Dim rowsoni As DataRow = dt.Rows(0)
                            Using ms As New IO.MemoryStream(CType(rowsoni(0), Byte()))
                                'Dim Pic As Image = Image.FromFile(openFile.FileName)
                                Dim Pic As Image = Image.FromStream(ms)
                                PictureBox1.Image = New Bitmap(Pic)
                                PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
                            End Using
                        End If
                    End Using
                End Using
            End Using
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        myconnection.close()
    End Sub
End Class

Download Project:
Download Project
Lihat Video:
Readmore → Source Code Game Puzzle Visual Basic

Senin, 11 Juli 2016

Error: Unable to Start Android Emulator in Visual Studio

Selain dapat membuat aplikasi android, di Visual Studio khususnya 2013-2015 kita juga dapat menjalankan emulator android yang sangat user friendly. Namun ketika anda menjalankan emulator tersebut malah terjadi error "Unable to Start the Emulator". Nah bagaimanakah cara mengatasi permasalahan tersebut? Silakan simak video panduannya berikut ini.
Lihat Video:
Readmore → Error: Unable to Start Android Emulator in Visual Studio

Error: The Microsoft Jet OleDB.xx is Not Registered on the Local Machine

Pernahkah anda mengalami permasalahan error "The Microsoft Jet OleDB.xx is Not Registered on the Local Machine" saat menjalankan program anda di Visual Studio. Jika iya masalah ini mungkin ditimbulkan karena anda berpindah dari satu komputer ke komputer lain dengan berbeda spesifikasi, khusunya bit sistem operasinya. Lalu bagaimana cara mengatasinya? Simak Video berikut ini.
Lihat Video:
Readmore → Error: The Microsoft Jet OleDB.xx is Not Registered on the Local Machine

Menampilkan Nomor Baris Kode Editor di Visual Studio

Tahukah anda bahwa di Visual Studio kita dapat menampilkan Line Number ataupun Nomor Baris untuk semua bahasa pemrograman yang disupport, baik itu Visual Basic (VB.NET), CSharp (C#), Cplusplus (C++) dll. Line number ini berfungsi mempermudah troubleshooting saat terjadi error pada baris kode program kita, bagaimana caranya? Simak video panduannya berikut ini.
Lihat Video:
Readmore → Menampilkan Nomor Baris Kode Editor di Visual Studio

Cara Menampilkan Record Database ke DataGridView Visual Basic

Berikut ini tutorial bagaimana cara menampilkan record database menggunakan item DataGridView di Visual Basic VB.NET. Untuk membuatnya anda membutuhkan class dan sebuah form, agar lebih jelas anda dapat mendownload project maupun melihat video panduan pembuatannya.
Kode Koneksi:

Imports MySql.Data.MySqlClient
Public Class koneksidata
    Dim conect As New MySqlConnection("server=localhost;uid=root;pwd='';database='dbgrid'")
    Public Function open() As MySqlConnection
        Try
            conect.Open()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Return conect
    End Function
    Public Function close() As MySqlConnection
        Try
            conect.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Return conect
    End Function
End Class
Kode Form1:

Imports MySql.Data.MySqlClient
Public Class Form1
#Region "deklarasi"
    Dim mycmd As New MySqlCommand
    Dim myconection As New koneksidata
    Dim dadapter As MySqlDataAdapter
    Dim dtable As New DataTable
#End Region
#Region "prosedur"
    Sub tampilkangrid()
        mycmd.Connection = myconection.open
        mycmd.CommandText = "select * from tbgrid order by id asc"
        dadapter = New MySqlDataAdapter(mycmd)
        dtable.Rows.Clear()
        dadapter.Fill(dtable)
        If Not dtable Is Nothing AndAlso dtable.Rows.Count > 0 Then
            DataGridView1.AutoGenerateColumns = False
            DataGridView1.DataSource = dtable
            DataGridView1.Columns(0).DataPropertyName = "id"
            DataGridView1.Columns(1).DataPropertyName = "nama"
        End If
        'With DataGridView1
        '    .Columns(0).HeaderText = "ID"
        '    .Columns(1).HeaderText = "Nama"
        'End With
        myconection.close()
    End Sub
    Sub klikgrid()
        Dim i As Integer
        Try
            With DataGridView1
                If .CurrentCell.Value Is Nothing Then
                    Exit Sub
                Else
                    i = .CurrentRow.Index
                    TID.Text = .Rows(i).Cells(0).Value.ToString
                    TNAMA.Text = .Rows(i).Cells(1).Value.ToString
                End If
            End With
        Catch ex As Exception
            MsgBox(ex.Message)
            Exit Sub
        End Try
    End Sub
#End Region
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        mycmd.Connection = myconection.open
        mycmd.CommandText = "insert into tbgrid(id,nama) values('" & TID.Text & "','" & TNAMA.Text & "')"
        mycmd.ExecuteNonQuery()
        myconection.close()
        tampilkangrid()
        MsgBox("Data disimpan !", MsgBoxStyle.Information, "Pemberitahuan !")
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        mycmd.Connection = myconection.open
        mycmd.CommandText = "update tbgrid set nama='" & TNAMA.Text & "' where id='" & TID.Text & "'"
        mycmd.ExecuteNonQuery()
        myconection.close()
        tampilkangrid()
        MsgBox("Data dirubah !", MsgBoxStyle.Information, "Pemberitahuan !")
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        mycmd.Connection = myconection.open
        mycmd.CommandText = "delete from tbgrid where id='" & TID.Text & "'"
        mycmd.ExecuteNonQuery()
        myconection.close()
        tampilkangrid()
        MsgBox("Data dihapus !", MsgBoxStyle.Information, "Pemberitahuan !")
    End Sub
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        tampilkangrid()
    End Sub
    Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        klikgrid()
    End Sub
End Class

Download Project:
Download Project
Lihat Video:
Readmore → Cara Menampilkan Record Database ke DataGridView Visual Basic

Cara Menampilkan Database Menggunakan ListView di Visual Basic

Berikut panduan bagaimana cara menampilkan record database menggunakan listview di Visual Basic. Anda perlu membuat class untuk koneksi data dan sebuah form untuk menempatkan listview beserta item yang lainnya. Agar lebih jelas anda dapat mendownload project maupun melihat video panduannya.
Kode Koneksi:

Imports MySql.Data.MySqlClient
Namespace accessdata
    Public Class koneksidata
        Dim conect As New MySqlConnection("server=localhost;uid=root;pwd='';database='skyars'")
        Public Function open() As MySqlConnection
            Try
                conect.Open()
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            Return conect
        End Function
        Public Function close() As MySqlConnection
            Try
                conect.Close()
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            Return conect
        End Function
    End Class
End Namespace
Kode Form1:

Imports MySql.Data.MySqlClient
Public Class Form1
#Region "deklarasi"
    Dim mycmd As New MySqlCommand
    Dim myconnection As New accessdata.koneksidata
    Dim objreader As MySqlDataReader
#End Region
#Region "prosedur"
    Sub bacalistview()
        Dim isi As ListViewItem
        LISTFORM.Items.Clear()
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "select * from tbtes"
        objreader = mycmd.ExecuteReader
        While objreader.Read
            isi = LISTFORM.Items.Add(objreader.Item("nomor").ToString)
            isi.SubItems.Add(objreader.Item("nama").ToString)
        End While
        myconnection.close()
    End Sub
    Sub kliklistview()
        Dim index As Integer
        If LISTFORM.SelectedItems.Count = 0 Then Exit Sub
        With LISTFORM
            index = .SelectedIndices(0)
            TNO.Text = .Items(index).Text
            TNAMA.Text = .Items(index).SubItems(1).Text
        End With
    End Sub
#End Region
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "insert into tbtes(nomor,nama) values('" & (TNO.Text) & "','" & (TNAMA.Text) & "')"
        mycmd.ExecuteNonQuery()
        myconnection.close()
        bacalistview()
        MsgBox("Berhasil disimpan !", MsgBoxStyle.Information, "Notice !")
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "update tbtes set nama='" & TNAMA.Text & "' where nomor='" & TNO.Text & "'"
        mycmd.ExecuteNonQuery()
        myconnection.close()
        bacalistview()
        MsgBox("Berhasil dirubah !", MsgBoxStyle.Information, "Notice !")
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "delete from tbtes where nomor='" & TNO.Text & "'"
        mycmd.ExecuteNonQuery()
        myconnection.close()
        bacalistview()
        MsgBox("Berhasil dihapus !", MsgBoxStyle.Information, "Notice !")
    End Sub
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        bacalistview()
    End Sub
    Private Sub LISTFORM_SelectedIndexChanged(sender As Object, e As EventArgs) Handles LISTFORM.SelectedIndexChanged
        kliklistview()
    End Sub
End Class

Download Project:
Download Project
Lihat Video:
Readmore → Cara Menampilkan Database Menggunakan ListView di Visual Basic

Cara Membuat Form Loading Keren di Visual Basic

Berikut ini adalah kode dan tutorial yang disertai video bagaimana cara membuat form loading keren menggunakan Visual Basic VB.NET. Untuk membuatnya anda membutuhkan 1 buah form dan satu buah module untuk mendeklarasikan MyFont, untuk lebih jelasnya anda dapat mendownload project dan melihat video tutorialnya.
Kode Form:

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Label1.Font = myfont.GetInstance(72, FontStyle.Bold)
    End Sub
    Private Sub TLOAD_Tick(sender As Object, e As EventArgs) Handles TLOAD.Tick
        Dim i As Double
        Static ictr As Integer
        For i = 1 To 100
            Label1.Text = ProgressBar1.Value
        Next
        If ictr <= 100 Then
            ProgressBar1.Value = ictr
            ictr = ictr + 1
        Else
            'FORM_UTAMA.Show() 'Ini Merupakan Form yang Akan Muncul Setelah Form Loading Selesai
            'Form_Login.Hide() 'Untuk Menyembunyikan Form Login
            Me.Close() 'Menutup Form Loading atau Form Ini
        End If
    End Sub
End Class
Kode MyFont:

Kode myfont:
Imports System.Drawing.Text
Imports System.Runtime.InteropServices
Module myfont
    '
    '' Start ==[Authors Line]==
    '' This tutorial by SkyArs (www.skyars.com)
    '' Don't remove this line for legal purposes
    '' End ====[Authors Line]====
    '
    'PRIVATE FONT COLLECTION TO HOLD THE DYNAMIC FONT
    Private _pfc As PrivateFontCollection = Nothing
    Public ReadOnly Property GetInstance(ByVal Size As Single,
                                         ByVal style As FontStyle) As Font
        Get
            'IF THIS IS THE FIRST TIME GETTING AN INSTANCE
            'LOAD THE FONT FROM RESOURCES
            If _pfc Is Nothing Then LoadFont()

            'RETURN A NEW FONT OBJECT BASED ON THE SIZE AND STYLE PASSED IN
            Return New Font(_pfc.Families(0), Size, style)

        End Get
    End Property
    Private Sub LoadFont()
        Try
            'INIT THE FONT COLLECTION
            _pfc = New PrivateFontCollection

            'LOAD MEMORY POINTER FOR FONT RESOURCE
            Dim fontMemPointer As IntPtr =
                Marshal.AllocCoTaskMem(
                My.Resources.digital_7.Length)

            'COPY THE DATA TO THE MEMORY LOCATION
            Marshal.Copy(My.Resources.digital_7,
                         0, fontMemPointer,
                         My.Resources.digital_7.Length)

            'LOAD THE MEMORY FONT INTO THE PRIVATE FONT COLLECTION
            _pfc.AddMemoryFont(fontMemPointer,
                               My.Resources.digital_7.Length)

            'FREE UNSAFE MEMORY
            Marshal.FreeCoTaskMem(fontMemPointer)
        Catch ex As Exception
            'ERROR LOADING FONT. HANDLE EXCEPTION HERE
        End Try
    End Sub
End Module

Download Project:
Download Project
Lihat Video:
Readmore → Cara Membuat Form Loading Keren di Visual Basic

Membuat Form Login di Visual Basic

Berikut ini adalah kode dan tutorial yang disertai video bagaimana cara membuat form login menggunakan Visual Basic VB.NET. Dalam tutorial saya menggunakan 2 form dan 1 module/class.
Kode Koneksi:

Imports MySql.Data.MySqlClient
Public Class koneksidata
    Dim conect As New MySqlConnection("server=localhost;user=root;password='';database='dblogin'")
    Public Function open() As MySqlConnection
        Try
            conect.Open()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Return conect
    End Function
    Public Function close() As MySqlConnection
        Try
            conect.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Return conect
    End Function
End Class
Kode Form1/Form Login:

Imports MySql.Data.MySqlClient
Public Class Form1
#Region "deklarasi"
    Dim mycmd As New MySqlCommand
    Dim myconnection As New koneksidata
    Dim objadapter As MySqlDataAdapter
    Dim objreader As MySqlDataReader
    Dim dtable As New DataTable
#End Region
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        objadapter = New MySqlDataAdapter("select username,password from tabellogin where username='" & Replace(TUSER.Text, "'", "''") & "' and password='" & Replace(TPASS.Text, "'", "''") & "'", myconnection.open)
        dtable.Clear()
        objadapter.Fill(dtable)
        If dtable.Rows.Count = Nothing Then
            MsgBox("Gagal Login !!")
        Else
            Form_Profil.Show()
            Me.Hide()
        End If
        myconnection.close()
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TUSER.Text = ""
        TPASS.Text = ""
    End Sub
End Class
Kode Form Profil:

Public Class Form_Profil
    Private Sub Form_Profil_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
        End
    End Sub
End Class

Download Project:
Download Project
Lihat Video:
Readmore → Membuat Form Login di Visual Basic

Jumat, 01 Juli 2016

Insert, Update, Delete Database di Visual Basic

Untuk menggunakan perintah insert, update dan delete ke database MySQL menggunakan pemrograman Visual Basic VB.NET, anda dapat menggunakan kode berikut, jika masih bingung Anda dapat melihat videonya agar lebih jelas. Kode Koneksi:
Namespace accessdata
    'Ini koneksi
    Public Class koneksidata
        Dim conect As New MySql.Data.MySqlClient.MySqlConnection("server=localhost;uid=root;pwd='';database='skyars'")
        Public Function open() As MySql.Data.MySqlClient.MySqlConnection
            Try
                conect.Open()
            Catch ex As Exception
                MsgBox("Localhost belum aktif atau coba cek database !!", MsgBoxStyle.Information, "Notice !!")
            End Try
            Return conect
        End Function
        Public Function close() As MySql.Data.MySqlClient.MySqlConnection
            Try
                conect.Close()
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            Return conect
        End Function
    End Class
End Namespace
Kode Form:
Imports MySql.Data.MySqlClient
Public Class Form1
#Region "deklarasi"
    Dim mycmd As New MySqlCommand
    Dim myconnection As New accessdata.koneksidata
#End Region
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "insert into tbtes(nomor,nama) values('" & TNO.Text & "','" & TNAMA.Text & "')"
        mycmd.ExecuteNonQuery()
        myconnection.close()
        MsgBox("Data berhasil disimpan !", MsgBoxStyle.Information, "Pemberitahuan!")
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "update tbtes set nama='" & TNAMA.Text & "' where nomor='" & TNO.Text & "'"
        mycmd.ExecuteNonQuery()
        myconnection.close()
        MsgBox("Data berhasil dirubah !", MsgBoxStyle.Information, "Pemberitahuan!")
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        mycmd.Connection = myconnection.open
        mycmd.CommandText = "delete from tbtes where nomor='" & TNO.Text & "'"
        mycmd.ExecuteNonQuery()
        myconnection.close()
        MsgBox("Data berhasil dihapus !", MsgBoxStyle.Information, "Pemberitahuan!")
    End Sub
End Class
Download Project:
Download Project
Lihat Video:
Readmore → Insert, Update, Delete Database di Visual Basic

Test Koneksi Database MySQL dengan Visual Basic

Untuk mengetes koneksi database MySQL dengan program Visual Basic VB.NET, Anda dapat menggunakan kode berikut. Silakan buat sebuah form dan tambahkan satu buah button, lalu tambahkan kodenya, kira-kira hasilnya nanti seperti dibawah.
Code:

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim conn As New MySql.Data.MySqlClient.MySqlConnection
        Dim koneksiku As String
        koneksiku = "server=localhost;uid=root;pwd='';database='skyars'"
        Try
            conn.ConnectionString = koneksiku
            conn.Open()
            MsgBox("Koneksi Berhasil", MsgBoxStyle.Information, "Informasi")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

End Class

Download Project:
Download Project
Lihat Video:
Readmore → Test Koneksi Database MySQL dengan Visual Basic

Kamis, 30 Juni 2016

Tipe Data di Visual Basic

Tipe Data di Visual Basic
Setiap bahasa pemrograman termasuk Visual Basic VB.NET tentunya memiliki berbagai macam tipe data. Variabel dan Konstanta pada Visual Basic VB.NET memiliki tipe data untuk menentukan suatu nilai yang dapat ditampung oleh Variabel dan Konstanta itu sendiri.

Berikut adalah beberapa tipe data yang terdapat pada Visual Basic VB.NET dan sering digunakan dalam membuat program.
No
Tipe Data
Ukuran (dalam bytes)
Deskripsi Jangkauan
1.
Byte
1
Nilai antara “0” sampai dengan “255”
2.
Boolean
1
Bernilai True (benar) atau False (Salah)
3.
Char
2
Menampung karakter Unicode
4.
Datetime
8
Nilai tanggal (1/1/0001) jam (11:59:59) sampai dengan tanggal (12/21/9999)
5.
Decimal
16
Untuk nilai negatif antara (-29228162514264222592542950225) sampai dengan (-0.000000000000000000000000001)
Untuk nilai positif antara(0.000000000000000000000000001) sampai dengan (29228162514264222592542950225)
6.
Double
8
Untuk nilai negatif antara (-1.29269212486222 E208) sampai dengan (-4.94065645841242 E-224)
Untuk nilai positif antara (4.94065645841242 E-224) sampai dengan (1.29269212486222 E208)
7.
Int16
2
(-22268) sampai dengan (22262)
8.
Int32

(-21424826048) sampai dengan (2142482642)
9.
Int64
8
(-9222222026854225808) sampai dengan (9222222026854225802)
10.
Integer
4
(-21424826048) sampai dengan (2142482642)
11.
Long
8
(-9222222026854225808) sampai dengan (9222222026854225802)
12.
Short
2
(-22268) sampai dengan (22262)
13.
Single
4
Untuk nilai negatif antara (-2.402822 E28) sampai dengan (-1.401298 E-45)
Untuk nilai positif antara (1.401298 E-45) sampai dengan (2.402822 E28)
14.
String

Deretan dari karakter Unicode
15.
UInt16
2
(0) sampai dengan (65525)
16.
UInt22
4
(0) sampai dengan (4294962295)
17.
UInt64
8
(0) sampai dengan (184462440222095551615)
Readmore → Tipe Data di Visual Basic
SkyArs Corp. © 2016. Tweaked by: Soni Sitez Powered by: Blogger