1. Pertama buatlah form dengan nama `frmMain` dan tambahkan 5 Label, 4 Textbox, 1 ComboBox, 2 Button dan 1 DataGridView seperti gambar dibawah ini.
  2. Sebelum kita ke Codingannya, kita buat 1 module yang berisikan.
    Imports MySql.Data.MySqlClient
    Module mdlMain
        Public conn As MySqlConnection
        Public cmd As MySqlCommand
        Public da As MySqlDataAdapter
        Public dr As MySqlDataReader
        Public ds As DataSet
        Public str As String
        Public db As Integer
    
        Sub koneksi()
            Try
                Dim str As String = "server=localhost; user id=root; password=; database= dbinput"
                conn = New MySqlConnection(str)
                If conn.State = ConnectionState.Closed Then
                    conn.Open()
                End If
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
    
    End Module
    
    
  3. Setelah itu kita isi Codingan yang terdapat didalam frmMain tadi.
    Imports MySql.Data.MySqlClient
    Public Class frmMain
    
        Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Call tampil()
        End Sub
        Sub tampil()
            Call koneksi()
            da = New MySqlDataAdapter("select * from tbdata", conn)
            ds = New DataSet
            da.Fill(ds, "data")
            dgv.DataSource = ds.Tables("data")
            dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
            dgv.RowsDefaultCellStyle.BackColor = Color.LightBlue
            dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.WhiteSmoke
    
        End Sub
    
    
        Private Sub bSimpan_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bSimpan.Click
            Call koneksi()
            For Each c As Control In Me.FlowLayoutPanel2.Controls
                If c.GetType IsNot GetType(Button) Then
                    If cAgama.Text = "" Or cAgama.Text = "0" Then
                        MsgBox("Data belum Lengkap", vbExclamation, "kesalahan")
                        cAgama.Focus()
                    End If
                End If
            Next
            Try
                Dim str As String
                str = "insert into tbdata value ('" & txtNIS.Text & "','" & txtNama.Text & "','" & txtJenis.Text & "','" & cAgama.Text & "','" & txtAlamat.Text & "')"
                cmd = New MySqlCommand(str, conn)
                cmd.ExecuteNonQuery()
                MessageBox.Show("insert data berhasil disimpan")
            Catch ex As Exception
                MessageBox.Show("insert data gagal disimpan")
            End Try
    
        End Sub
    
     
    
        Private Sub bReset_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bReset.Click
            txtNIS.Text = ""
            txtNama.Text = ""
            txtJenis.Text = ""
            cAgama.Text = ""
            txtAlamat.Text = ""
        End Sub
    
        Private Sub txtNIS_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtNIS.KeyDown, txtNama.KeyDown, txtJenis.KeyDown, txtAlamat.KeyDown, cAgama.KeyDown, bSimpan.KeyDown, bReset.KeyDown
            If e.KeyCode = Keys.Enter Then
                SelectNextControl(sender, True, True, True, True)
            End If
        End Sub
    End Class