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

عاااجل .. مشكلة في الarrays

مغلق
بدأه CoOoNaN في 28 ديسمبر 2006 · 0 رد · 305 مشاهدة · في لغة Ms Visual Basic 6 وما قبلها من إصدارات
مشاركة: واتساب X فيسبوك تيليجرام
#1

السلاااام عليييكم جميييييعا ..

الله يخليييييكم ابغيكم تساعدووووني من امس وانا احاول احل هالمشكلة وما قادرة وما تام عندي وقت ..

المشكلة ومافيها اني كاتبه كود احاول فيه اني انقع المعلومات من sequential file الى parallel arrays

كل شي يكون اوكي اذا دخلت ريكورد واحد .. لكن يوم ادخل ريكوردين يطلعلي ايرور ويقولي ...

Index was outside the bounds of the array!!!!!!

والله تعبت وانا احاول اغير واعدل وماشي فايده .. ياليت تشوفولي الحلللللللل ..

وهذا هو الكوووود ....

Public Class frmLoadingAssetsDetails

Dim intTotalRecords As Integer = 0

Dim strName As String

Dim DecHistoricalCost As Decimal = 0

Dim intUsefulLife As Integer = 0

Dim DecScrapValue As Decimal = 0

Dim intUpperBound As Integer

Dim strNamesArray(intUpperBound) As String

Dim decHistoricalCostsArray(intUpperBound) As Decimal

Dim intUsefulLifeValuesArray(intUpperBound) As Integer

Dim DecScrapValuesArray(intUpperBound) As Decimal

Private Sub btnStore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStore.Click

' If DataEntryAndSelectionValidation() = True Then

If UCase(txtName.Text) <> "END" Then

CreatingSequentialFile(intTotalRecords)

Exit Sub

Else

FileClose(1)

LoadArrayFromFile(strNamesArray, decHistoricalCostsArray, _

intUsefulLifeValuesArray, DecScrapValuesArray, intUpperBound)

End If

' End If

End Sub

Private Sub CreatingSequentialFile(ByRef intTotalRecords As Integer)

Do While UCase(txtName.Text) <> "END"

WriteLine(1, txtName.Text, CDec(txtHC.Text), _

CInt(cboUsefulLife.Text), CDec(txtScrap.Text))

txtName.Clear()

txtHC.Clear()

cboUsefulLife.Text = "Choose number of years"

txtScrap.Clear()

txtName.Focus()

intTotalRecords += 1

Exit Sub

Loop

Private Sub LoadArrayFromFile(ByRef strNamesArray() As String, ByRef decHistoricalCostsArray() As Decimal, ByRef intUsefulLifeValuesArray() As Integer, ByRef DecScrapValuesArray() As Decimal, ByRef intUpperBound As Integer)

Dim Count As Integer = 0

intUpperBound = intTotalRecords - 1

FileOpen(1, "c:\AssetDetails.txt", OpenMode.Input)

MsgBox(intUpperBound)

Do While Not EOF(1)

Input(1, strNamesArray(Count))

Input(1, decHistoricalCostsArray(Count))

Input(1, intUsefulLifeValuesArray(Count))

Input(1, DecScrapValuesArray(Count))

Count += 1

Loop

Count = 0

For Count = 0 To UBound(strNamesArray)

lstDetails.Items.Add(String.Format("{0,-20} {1,8} {2,15}", decHistoricalCostsArray(Count), intUsefulLifeValuesArray(Count), DecScrapValuesArray(Count)))

Next

FileClose(1)

End Sub

End Class

الخطا يطلعلي مكان الاحمر ..

الله يخلييييييكم ابغي مساعدتكم بسرررررعة ماعندي وقت مووول ..

تم تعديل هذه المشاركة بواسطة CoOoNaN في 28 ديسمبر 2006 في 15:28

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

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