Quantcast
Channel: VBForums - Mobile Development
Viewing all articles
Browse latest Browse all 96

sum numbers in a text file

$
0
0
Hi,

I'm trying to add the numbers in a text file and show the result on a label.
Quote:

Public Function GetInitialTime(ByVal TotalTime As Integer) As String

Dim fileContents() As String = IO.File.ReadAllLines("\My Documents\my_Counter.txt")
Dim sum As Long = (From item In fileContents Select CLng(item)).Sum

TotalTime = sum
Tot_Time = TotalTime

Sec = TotalTime Mod 60
Min = ((TotalTime - Sec) / 60) Mod 60
Hrs = ((TotalTime - (Sec + (Min * 60))) / 3600)

Return Format(Hrs, "000000") & ":" & Format(Min, "00") & ":" & Format(Sec, "00")
End Function
For the mobile phone (win6.5) development it comes with an error:
Quote:

"ReadAllLines" is not a member of "System.IO.File"
But if I create a development for a PC application and use the same code, it works fine.

Can anybody help me?
Or has anybody got another idea of how to add all lines (there are only numbers on each line) in my text file?

Thanks.

Viewing all articles
Browse latest Browse all 96

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>