hi all
how to get the highest date of txt file
how to get the max value of arrayForTheLine(3) in 14 lines( that's mean count highet date line - 14) and when i get the max how to get the date of the line that has the max value
this the file
<ticker>,<date>,<open>,<high>,<low>,<close>,<vol>
aaaa,20100919,19.8,19.95,19.7,19.7,222643
aaaa,20100918,20.05,20.1,19.75,19.9,174402
aaaa,20100915,19.8,19.9,19.65,19.9,351537
aaaa,20100914,19.8,19.9,19.6,19.8,696911
aaaa,20100906,19.75,19.9,19.55,19.65,772510
aaaa,20100905,20.2,20.45,19.75,19.85,875499
aaaa,20100904,20.8,20.9,20,20.2,778366
aaaa,20100901,19.4,20.9,19.4,20.65,496819
aaaa,20100831,19.55,19.7,19.45,19.45,163574
aaaa,20100830,19.5,20.3,19.4,19.8,455908
aaaa,20100829,20.15,20.15,19.3,19.6,476880
aaaa,20100828,21,21,20.05,20.1,395201
aaaa,20100825,20.8,21.35,19.1,20.85,568433
aaaa,20100824,22.15,22.5,21,21,198542
aaaa,20100823,22.9,22.9,21.6,22,309772
aaaa,20100822,22.95,22.95,22.65,22.8,120463
aaaa,20100821,23,23.25,22.5,22.85,299538
aaaa,20100818,22.8,23.45,22.5,22.95,906171
aaaa,20100817,22.9,23.3,22.5,22.75,514636
aaaa,20100816,22,23.5,21.55,22.95,1580438
aaaa,20100815,22.2,22.5,21.45,22.1,616626
aaaa,20100814,22.5,23.7,21.6,22,1795921
aaaa,20100811,20.7,22.9,20.55,22,1617880
aaaa,20100810,20.7,21.15,20.5,20.85,885246
aaaa,20100809,20.85,21,20.75,20.9,106036
aaaa,20100808,21.15,21.35,20.85,20.95,284957
aaaa,20100807,20.9,22,20.9,21.3,932640
aaaa,20100804,21,21.15,20.55,20.95,212297
i try this code
Dim maxtxtfile As Date = Date.Parse((maxtxtfile))
Dim comboText As String = ComboBox2.SelectedItem.ToString()
Dim maxdate As Date
Dim maxHigh As Double = 0
For Each line As String In Lines
Dim SplitString As String() = line.Split(","c)
If (SplitString.Length > 1) And (SplitString(0).Equals(comboText)) Then
Try
maxtxtfile = If(Date.TryParse(SplitString(1), Nothing), _
CDate(SplitString(1)), CDate(New Date(Val(SplitString(1).Substring(0, 4)), Val(SplitString(1).Substring(4, 2)), Val(SplitString(1).Substring(6, 2))).ToShortDateString))
If maxtxtfile > DateAdd("d", -14, Date.Today()) Then
If Double.Parse(SplitString(3)) > maxHigh Then
maxHigh = Double.Parse(SplitString(3))
maxdate = maxtxtfile
End If
End If
Catch
End Try
End If
Next
TextBox1.Text = maxHigh
TextBox2.Text = maxdate
End Sub
but not what i am looking for
thank you for your help
how to get the highest date of txt file
how to get the max value of arrayForTheLine(3) in 14 lines( that's mean count highet date line - 14) and when i get the max how to get the date of the line that has the max value
this the file
<ticker>,<date>,<open>,<high>,<low>,<close>,<vol>
aaaa,20100919,19.8,19.95,19.7,19.7,222643
aaaa,20100918,20.05,20.1,19.75,19.9,174402
aaaa,20100915,19.8,19.9,19.65,19.9,351537
aaaa,20100914,19.8,19.9,19.6,19.8,696911
aaaa,20100906,19.75,19.9,19.55,19.65,772510
aaaa,20100905,20.2,20.45,19.75,19.85,875499
aaaa,20100904,20.8,20.9,20,20.2,778366
aaaa,20100901,19.4,20.9,19.4,20.65,496819
aaaa,20100831,19.55,19.7,19.45,19.45,163574
aaaa,20100830,19.5,20.3,19.4,19.8,455908
aaaa,20100829,20.15,20.15,19.3,19.6,476880
aaaa,20100828,21,21,20.05,20.1,395201
aaaa,20100825,20.8,21.35,19.1,20.85,568433
aaaa,20100824,22.15,22.5,21,21,198542
aaaa,20100823,22.9,22.9,21.6,22,309772
aaaa,20100822,22.95,22.95,22.65,22.8,120463
aaaa,20100821,23,23.25,22.5,22.85,299538
aaaa,20100818,22.8,23.45,22.5,22.95,906171
aaaa,20100817,22.9,23.3,22.5,22.75,514636
aaaa,20100816,22,23.5,21.55,22.95,1580438
aaaa,20100815,22.2,22.5,21.45,22.1,616626
aaaa,20100814,22.5,23.7,21.6,22,1795921
aaaa,20100811,20.7,22.9,20.55,22,1617880
aaaa,20100810,20.7,21.15,20.5,20.85,885246
aaaa,20100809,20.85,21,20.75,20.9,106036
aaaa,20100808,21.15,21.35,20.85,20.95,284957
aaaa,20100807,20.9,22,20.9,21.3,932640
aaaa,20100804,21,21.15,20.55,20.95,212297
i try this code
Dim maxtxtfile As Date = Date.Parse((maxtxtfile))
Dim comboText As String = ComboBox2.SelectedItem.ToString()
Dim maxdate As Date
Dim maxHigh As Double = 0
For Each line As String In Lines
Dim SplitString As String() = line.Split(","c)
If (SplitString.Length > 1) And (SplitString(0).Equals(comboText)) Then
Try
maxtxtfile = If(Date.TryParse(SplitString(1), Nothing), _
CDate(SplitString(1)), CDate(New Date(Val(SplitString(1).Substring(0, 4)), Val(SplitString(1).Substring(4, 2)), Val(SplitString(1).Substring(6, 2))).ToShortDateString))
If maxtxtfile > DateAdd("d", -14, Date.Today()) Then
If Double.Parse(SplitString(3)) > maxHigh Then
maxHigh = Double.Parse(SplitString(3))
maxdate = maxtxtfile
End If
End If
Catch
End Try
End If
Next
TextBox1.Text = maxHigh
TextBox2.Text = maxdate
End Sub
but not what i am looking for
thank you for your help