13-03-17, 12:26 AM
السلام عليكم
تفضب الكود
تفضب الكود
كود :
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

