الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

something wrong with the variable passing

مغلق
بدأه adeeb في 7 يوليو 2002 · 1 رد · 479 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

I commented the mistake or the wrong with this code . it is about the variable sum and avg they do not work for some reason please somebody tell me what is wrong with this code

()Private Sub Command1_Click

Dim sum As Double, avg As Double

If Command1.Caption = "New Data Set" Then

vCount = InputBox("how many values do you want to enter")

If Not IsNumeric(vCount) Then

MsgBox "Please enter a numeric data"

Exit Sub

End If

For i = 1 To vCount

Load Label1(i)

Load Text1(i)

Label1(i).Top = Label1(i - 1).Top + 1.25 * Label1(i).Height

Text1(i).Top = Text1(i - 1).Top + 1.25 * Text1(i).Height

Label1(i).Visible = True

Text1(i).Visible = True

Label1(i).Caption = "Value# " & i

Next

Me.Height = Text1(vCount).Top + 2.5 * Text1(vCount).Height

Command1.Caption = "Calculate Data now"

Else

For i = 1 To vCount 'the variable vCount is not passed to this statement?

If IsNumeric(Text1(i).Text) Then

sum = sum + Text1(i)

End If

Next

avg = sum / vCount ' the variable vCount is not passed to this statement?

MsgBox "the average is & avg"

For i = 1 To vCount

Unload Label1(i)

Unload Text1(i)

Next

Me.Height = 2000

Command1.Caption = "New Data Set"

End If

End Sub

#2

هناك الكثير من المتغيرات التى لا أعرف سبباً لوجودها..

ويا حبذا لو تخبرنى ما هو المطلوب من البرنامج ليقوم بعمله

هذا الموضوع مغلق.

مواضيع مشابهة