01-07-20, 02:50 PM
السلام عليكم ورحمة الله وبركاته
لدي 2 كومبوبوكس و 2 تيكت بوكس
ويتم إستدعاء الدالة من الموديل
أريد إختصار للدوال لتصبح على الأقل دالتين
لدي 2 كومبوبوكس و 2 تيكت بوكس
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SB, SIEP As Double
SB = GetTSDB_B(Val(CboE.Text))
SIEP = GetTAEP_B(Val(CboE.Text), Val(CboAEP.Text))
SBase.Text = CStr(SB.ToString("#,##0.00"))
IEP.Text = CStr(SIEP.ToString("#,##0.00"))
End Sub
ويتم إستدعاء الدالة من الموديل
كود :
Function GetTSDB_A(ByVal EC As Integer) As Double
If (EC < 1 Or EC > 2) Then Return 0
Dim ASDB() As Integer = {2900, 3050}
Dim TASDB As Double = (ASDB(EC - 1) * 19)
Return TASDB
End Function
Function GetTAEP_A(ByVal EC As Integer, ByVal AEP As Integer) As Double
If (EC < 1 Or EC > 2) Or (AEP < 1 Or AEP > 12) Then Return 0
Dim ARAEP(,) As Integer = { _
{145, 290, 435, 580, 725, 870, 1015, 1160, 1305, 1450, 1595, 1740}, {153, 306, 459, 612, 765, 918, 1071, 1224, 1377, 1530, 1683, 1836}}
Dim TAEP As Double = (ARAEP((EC - 1), (AEP - 1)) * 19)
Return TAEP
End Function
Function GetTSDB_B(ByVal EC As Integer) As Double
If (EC < 1 Or EC > 2) Then Return 0
Dim ASDB() As Integer = {3200, 3350}
Dim TASDB As Double = (ASDB(EC - 1) * 19)
Return TASDB
End Function
Function GetTAEP_B(ByVal EC As Integer, ByVal AEP As Integer) As Double
If (EC < 1 Or EC > 2) Or (AEP < 1 Or AEP > 12) Then Return 0
Dim ARAEP(,) As Integer = { _
{160, 230, 480, 640, 800, 960, 1120, 1280, 1440, 1600, 1760, 1920}, {168, 336, 504, 672, 840, 1008, 1176, 1344, 1512, 1680, 1848, 2016}}
Dim TAEP As Double = (ARAEP((EC - 1), (AEP - 1)) * 19)
Return TAEP
End Function
أريد إختصار للدوال لتصبح على الأقل دالتين