منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : file code
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
احتاج مساعدتكم في هذا السؤال مطلوب 2 files الاول أقرأ منه والثاني اكتب فيه .

Write a program that will read information from MyList.txt file then create MyReceipt.txtfile. Suppose that a file MyList.txt contains the following data.
 
  هذا اسم الملف الاول الخاص بالقراءه MyList.txt
] [/url] ][/url]
 
 
 هذا الثاني الخاص بالكتابه And as result MyReceipt.txt file will be:
] [/url]
 
In MyList.txt, second line represent item name, item price, and if it is available in the store or not, respectively.
Note:
Use try and catch to handle the case when the input file does not exist, such that an appropriate message is displayed and the program terminates.
 

تكررت الصور اكثر من مره لا اعلم السبب اعتذر
السلام عليكم

تفضب الكود
كود :
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    Dim l() As String = IO.File.ReadAllLines("MyList.txt")

    Dim r As New System.Text.StringBuilder

    r.AppendLine("My Receipt:")
    r.AppendLine("------------------------")

    Dim total As Double = 0

    For i = 0 To l.Length - 1

        If l(i).Contains("Done") Then

            Dim s As String = l(i).Replace("Done", "").Trim
            r.AppendLine(s)

            Dim v As Double = Val(s.Substring(s.LastIndexOf(" ")))
            total += v

        End If

    Next

    r.AppendLine("------------------------")
    r.AppendLine("Total = " & total)

    IO.File.WriteAllText("MyReceipt.txt", r.ToString)

    MsgBox(r.ToString)

End Sub