วันศุกร์ที่ 16 มกราคม พ.ศ. 2552

Overload Function In VB.NET




' VB.NET Overloads Function Sum Source Code

Option Explicit On
Option Strict On

Public Class Form1

Private Overloads Function Sum(ByVal A As Integer, ByVal B As Integer) As Integer
Sum = A + B
End Function

Private Overloads Function Sum(ByVal T As Single, ByVal U As Single) As Single
If T <= 0 Or U <= 0 Then
T = 1
U = 1
End If
Sum = T + U
End Function

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.Escape
End
End Select
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedToolWindow
Me.BackColor = Color.Bisque
Me.Width = 200
Me.Height = 50
Me.Text = " Sum : " & Sum(10, 10) & " Sum : " & Sum(15.5, 25.35)
End Sub

End Class

' Design VB.NET Source Code Games By Fernando Firaht

ไม่มีความคิดเห็น:

แสดงความคิดเห็น