Mesran

Hanya ingin berbagi kebaikan dan mendapatkan kebaikan yang lain.

Sir, I Want Question ?

My Lecture  : Right, I like this !  Go a head.

Aldyan Kid : How we can process discount without we click Proses button?

My Lecture : Good idea. We can process discount without click Proses button. how do that? it’s simple, just we press Enter Key, at the Keyboard. Let’s see this modification program in link (https://mesran.wordpress.com/2011/10/16/pemakaian-if-pada-vb-net/)

Public Class Form1

    Private Sub btnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapus.Click
        Pembeli.Text = ""
        Harga.Text = ""
        Discount.Text = ""
        Pembayaran.Text = ""
        Pembeli.Focus()
    End Sub

    Private Sub btnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProses.Click
        If Harga.Text > 5000000 Then
            Discount.Text = 0.1 * Harga.Text
        Else
            Discount.Text = 0
        End If

        Pembayaran.Text = Harga.Text - Discount.Text
    End Sub

    Private Sub btnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKeluar.Click
        End
    End Sub

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

    Private Sub Harga_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Harga.KeyPress
        If e.KeyChar = Chr(13) Then
            Call btnProses_Click(sender, e)
        End If
    End Sub

End Class

NOTES :

Private Sub Harga_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Harga.KeyPress
        If e.KeyChar = Chr(13) Then
            Call btnProses_Click(sender, e)
        End If
    End Sub

Look that statement, with using IF statement

if we press Enter Key then program just Call a Subroutine btnProses_Click(sender, e) 

My Lecturer : Well are Aldyan, understood?

Aldyan Kid : Yes sir, thanks.

Filed under: VB2008Tips, VS2008, ,

Terima kasih telah memberikan komentar anda.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives Per Tahun

Sponsored

C&C Online Shop

Blog Stats

  • 356,504 sejak 12 Jan 2011

User’s Online


My Music

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 223 other followers

October 2011
M T W T F S S
« Sep   Nov »
 12
3456789
10111213141516
17181920212223
24252627282930
31  
%d bloggers like this: