Senin, 15 Oktober 2018

Source code untuk KeyPress dan Warna pada datagridview

Warna Pada DataGridview

1. Source code KeyPress

 Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles idpegawai.KeyPress
        If e.KeyChar = Chr(13) Then
            Call cari()
            nama.Focus()
        End If
    End Sub

    Private Sub nama_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles nama.KeyPress
        If e.KeyChar = Chr(13) Then
            ttl.Focus()
        End If
    End Sub

    Private Sub ttl_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ttl.KeyPress
        If e.KeyChar = Chr(13) Then
            ComboBox1.Focus()
        End If
    End Sub

    Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
        If e.KeyChar = Chr(13) Then
            alamat.Focus()
        End If
    End Sub

    Private Sub alamat_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles alamat.KeyPress
        If e.KeyChar = Chr(13) Then
            notelp.Focus()
        End If
    End Sub

    Private Sub notelp_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles notelp.KeyPress
        If e.KeyChar = Chr(13) Then
            pangkat.Focus()
        End If
    End Sub

    Private Sub pangkat_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles pangkat.KeyPress
        If e.KeyChar = Chr(13) Then
            jabatan.Focus()
        End If
    End Sub

*Note : jabatan.fokus() jabatan adalah nama textbox
---------------------------------------------------------------------------------------
2.Source kode untuk warna pada datagridview
 Sub warnagrid()
        DataGridView1.GridColor = Color.CornflowerBlue
        DataGridView1.RowsDefaultCellStyle.BackColor = Color.CornflowerBlue
        DataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.SkyBlue
        DataGridView1.GridColor = Color.SkyBlue

    End Sub
Bagaimana reaksi Anda tentang artikel ini?