اخي الكريم
بعد تحميل مشروعك وتشغيله رايت انك تحاول تحويل القيم الموجودة في التكست بوكس كلها الى نوع Double رغم ان التكست بوكس لاتحتوي على قيمة
او لها قيمة String.Empty وقد كان المفروض انك تتحقق فيما اذا كان تكست بوكس لايحمل قيمة ان تعطيه القيمة 0
استبدل الكود في الاجراء mysub بالتالي
كود :
Public Sub mysub()
Dim a, b, c, d, f, g, h, i, j, k, tva, ttc, ven, ach As Double
If TextBox1.Text = "" Then
TextBox1.Text = 0
End If
If TextBox5.Text = "" Then
TextBox5.Text = 0
End If
If TextBox7.Text = "" Then
TextBox7.Text = 0
End If
If TextBox8.Text = "" Then
TextBox8.Text = 0
End If
If TextBox9.Text = "" Then
TextBox9.Text = 0
End If
If TextBox10.Text = "" Then
TextBox10.Text = 0
End If
a = CDbl(TextBox1.Text)
f = CDbl(TextBox5.Text)
h = CDbl(TextBox7.Text)
i = CDbl(TextBox8.Text)
j = CDbl(TextBox9.Text)
k = CDbl(TextBox10.Text)
'===============================الخمس المودع===================================
b = a / 5
'==================================التسجيــــــل===============================
c = a * 5 / 100
If c <= 1500 Then
c = 1500
End If
'==================================الشهر العقاري================================
d = a * 1 / 100
If d <= 2000 Then
d = 2000
End If
'====================================الأتعاب======================================
If a > 1000000 Then
g = 15000 + 10000 + ((a - 1000000) * 0.01)
ElseIf a > 500000 Then
g = 15000 + ((a - 500000) * 0.02)
ElseIf a <= 500000 Then
g = 15000
End If
'====================================TVA===========================================
tva = (g + h + i + j + k) * 19 / 100
If RadioButton2.Checked = True Then
tva = 0
End If
ttc = c + d + f + g + h + i + j + k + tva
'=====================================البائــــع==================================
ven = c / 2
'=====================================المشتري=====================================
ach = ttc - ven
'===================================================================================
TextBox2.Text = Str(b)
TextBox3.Text = Str(c)
TextBox4.Text = Str(d)
TextBox6.Text = Str(g)
TextBox11.Text = Str(tva)
TextBox12.Text = Str(ttc)
TextBox13.Text = Str(ven)
TextBox14.Text = Str(ach)
'================================================================
TextBox1.Text = FormatNumber(a, 2)
TextBox2.Text = FormatNumber(b, 2)
TextBox3.Text = FormatNumber(c, 2)
TextBox4.Text = FormatNumber(d, 2)
TextBox5.Text = FormatNumber(f, 2)
TextBox6.Text = FormatNumber(g, 2)
TextBox7.Text = FormatNumber(h, 2)
TextBox8.Text = FormatNumber(i, 2)
TextBox9.Text = FormatNumber(j, 2)
TextBox10.Text = FormatNumber(k, 2)
TextBox11.Text = FormatNumber(tva, 2)
TextBox12.Text = FormatNumber(ttc, 2)
TextBox13.Text = FormatNumber(ven, 2)
TextBox14.Text = FormatNumber(ach, 2)
End Sub
(26-05-20, 03:12 AM)معاند الحظ كتب : اخي الكريم
بعد تحميل مشروعك وتشغيله رايت انك تحاول تحويل القيم الموجودة في التكست بوكس كلها الى نوع Double رغم ان التكست بوكس لاتحتوي على قيمة
او لها قيمة String.Empty وقد كان المفروض انك تتحقق فيما اذا كان تكست بوكس لايحمل قيمة ان تعطيه القيمة 0
استبدل الكود في الاجراء mysub بالتالي
كود :
Public Sub mysub()
Dim a, b, c, d, f, g, h, i, j, k, tva, ttc, ven, ach As Double
If TextBox1.Text = "" Then
TextBox1.Text = 0
End If
If TextBox5.Text = "" Then
TextBox5.Text = 0
End If
If TextBox7.Text = "" Then
TextBox7.Text = 0
End If
If TextBox8.Text = "" Then
TextBox8.Text = 0
End If
If TextBox9.Text = "" Then
TextBox9.Text = 0
End If
If TextBox10.Text = "" Then
TextBox10.Text = 0
End If
a = CDbl(TextBox1.Text)
f = CDbl(TextBox5.Text)
h = CDbl(TextBox7.Text)
i = CDbl(TextBox8.Text)
j = CDbl(TextBox9.Text)
k = CDbl(TextBox10.Text)
'===============================الخمس المودع===================================
b = a / 5
'==================================التسجيــــــل===============================
c = a * 5 / 100
If c <= 1500 Then
c = 1500
End If
'==================================الشهر العقاري================================
d = a * 1 / 100
If d <= 2000 Then
d = 2000
End If
'====================================الأتعاب======================================
If a > 1000000 Then
g = 15000 + 10000 + ((a - 1000000) * 0.01)
ElseIf a > 500000 Then
g = 15000 + ((a - 500000) * 0.02)
ElseIf a <= 500000 Then
g = 15000
End If
'====================================TVA===========================================
tva = (g + h + i + j + k) * 19 / 100
If RadioButton2.Checked = True Then
tva = 0
End If
ttc = c + d + f + g + h + i + j + k + tva
'=====================================البائــــع==================================
ven = c / 2
'=====================================المشتري=====================================
ach = ttc - ven
'===================================================================================
TextBox2.Text = Str(b)
TextBox3.Text = Str(c)
TextBox4.Text = Str(d)
TextBox6.Text = Str(g)
TextBox11.Text = Str(tva)
TextBox12.Text = Str(ttc)
TextBox13.Text = Str(ven)
TextBox14.Text = Str(ach)
'================================================================
TextBox1.Text = FormatNumber(a, 2)
TextBox2.Text = FormatNumber(b, 2)
TextBox3.Text = FormatNumber(c, 2)
TextBox4.Text = FormatNumber(d, 2)
TextBox5.Text = FormatNumber(f, 2)
TextBox6.Text = FormatNumber(g, 2)
TextBox7.Text = FormatNumber(h, 2)
TextBox8.Text = FormatNumber(i, 2)
TextBox9.Text = FormatNumber(j, 2)
TextBox10.Text = FormatNumber(k, 2)
TextBox11.Text = FormatNumber(tva, 2)
TextBox12.Text = FormatNumber(ttc, 2)
TextBox13.Text = FormatNumber(ven, 2)
TextBox14.Text = FormatNumber(ach, 2)
End Sub
بارك الله فيك ، بقي امر واحد للتصحيح على الجهاز المجنون