how to perform aggregate computations such as Sum, Average, Min, and Max from txt file

Posted by Learn Vb under VB.NET on 1/24/2012 | Points: 10 | Views : 1255 | Status : [Member] | Replies : 0
i have combobox1 contain the name of the txt file that stored in c:/

Public Class Form1

Dim Lines As String()

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Lines = File.ReadAllLines("c:\" + ComboBox1.SelectedItem.ToString() + ".txt")
Dim list As New List(Of String)
Dim notcable As Boolean = False
For Each line As String In Lines
Dim SplitString As String() = line.Split(","c)
If SplitString.Length > 1 Then
If Not (list.Contains(SplitString(0))) Then
If notcable Then
notcable = True
End If
End If
End If
End Sub

2- combobox that will show the items from the txt file and the compute will be performed for the item that show in combobox2

so this what i did so far

1- to get the last date for the txt file by any sort

Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

Dim comboText As String = ComboBox2.SelectedItem.ToString()
Dim strDate As Integer = 0
For Each line In Lines

Dim arrayForTheLine = line.Split(","c)

If arrayForTheLine(1) > strDate Then
strDate = Integer.Parse(arrayForTheLine(1))
TextBox1.Text = strDate.ToString

End If
End Try

End Sub

the date will be show as Integer

i explain what i need in the image below


thank you for your help

thank you for your support


(No response found.)

Login to post response