aniskhan
Well-known member
I have a file with times in rows and columns(5)
I want to take these times from file to array
the problem is with
if i use above syntax for simple date variable it works
VB.NET:
12:00:00 01:00:00 03:00:00 12:00:00 09:12:12
01:00:00 03:00:00 12:00:00 01:00:00 09:12:12
03:00:00 12:00:00 01:00:00 03:00:00 09:12:12
12:00:00 01:00:00 03:00:00 12:00:00 09:12:12
I want to take these times from file to array
VB.NET:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fs As New FileStream("c://file1.txt", FileMode.Open, FileAccess.Read)
Dim rs As New StreamReader(fs)
Dim strText As String
Dim pray(,) As Date
Dim str() As String
Dim str1() As String
Dim i, j As Integer
For i = 0 To 3
strText = rs.ReadLine & ControlChars.CrLf
'split the line read into individual time strings and str1 will have length 5
str1 = Split(strText, " ")
For j = 0 To 4
'split the line str1() into str() will have length 3 having Hr:Min:sec
str = Split(str1(j), ":")
pray(i, j) = New DateTime(Today.Year, Today.Month, Today.Day, Val(str(0)), Val(str(1)), Val(str(2)))
Next
Next
rs.Close()
End Sub
the problem is with
VB.NET:
pray(i, j) = New DateTime(Today.Year, Today.Month, Today.Day, Val(str(0)), Val(str(1)), Val(str(2)))
if i use above syntax for simple date variable it works
VB.NET:
dte = New DateTime(Today.Year, Today.Month, Today.Day, Val(str(0)), Val(str(1)), Val(str(2)))