الله يخليك اذكنت تعرف فحلة لي باسرع وقت الة يخليك.
اكتب برنامج يقوم بحساب جدول الضرب لاي رقم تقوم بادخالة وستضهر النتيجة في مربع النص
مع ملاحظة ان الرقم سيتم ادخاله عن طريق ان بوت بوكس بعد النقر على زر ضرب؟
الله يخليك اذكنت تعرف فحلة لي باسرع وقت الة يخليك.
اكتب برنامج يقوم بحساب جدول الضرب لاي رقم تقوم بادخالة وستضهر النتيجة في مربع النص
مع ملاحظة ان الرقم سيتم ادخاله عن طريق ان بوت بوكس بعد النقر على زر ضرب؟
Public Class Math Function Add(ByVal No1 As Double, ByVal No2 As Double) As Double Add = No1 + No2 End Function Function Subtract(ByVal No1 As Double, ByVal No2 As Double) As Double Subtract = No1 - No2 End Function Function Multiple(ByVal No1 As Double, ByVal No2 As Double) As Double Multiple = No1 * No2 End Function Function Divide(ByVal No1 As Double, ByVal No2 As Double) As Double Divide = No1 / No2 End Function ' you can write here the same functions that handles any kinds 'of math operations, like above. End Class
then instantiate a new object from Class "Math"
Private MathObj As New Math()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing And TextBox2.Text = Nothing Then
MessageBox.Show("You must enter a No. in both fields", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
If TextBox1.Text = Nothing Then
MessageBox.Show("You must enter a No. in the first field", "1st Field", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
If TextBox2.Text = Nothing Then
MessageBox.Show("You must enter a No. in the second field", "2nd Field", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Label1.Text = MathObj.Add(TextBox1.Text, TextBox2.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox3.Text = Nothing Then
MessageBox.Show("You must enter a No. in the first field", "2nd Field", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
If TextBox4.Text = Nothing Then
MessageBox.Show("You must enter a No. in the second field", "2nd Field", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Label3.Text = MathObj.Subtract(TextBox3.Text, TextBox4.Text)
End Sub...hope that will help
رأس الحكمة الإيمان بالله
هذا الموضوع مغلق.