Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

OK :) ... it's other way...

 

I just want want to advise you that the cast to a var of the type Object is much less performant than to a var of the specific type you want... in thei case I think you shold use the String.

Software bugs are impossible to detect by anybody except the end user.
  • 2 weeks later...
Posted

me again...

 

Stress is here once again�

 

After I made my dynamic charts for viewing my static data with last 7 days and last six months, now is time to load real data into the charts.

 

I write a code for loading the file for current day and have no idea how to load the previous day, and so on...

 

I have in my root application all the values for data for each day. In my chart I have day columns and I need to put the values from each file.

 

Ex:

 

File for current day: 24102003.txt

File for previous day: 23102003.txt

Etc for all seven days

 

The code:

 

 


       Dim day As String
       Dim month As String
       Dim year As String
       Dim ext As String = ".txt"

       day = Format(Now, "dd")
       month = Format(Now, "MM")
       year = Format(Now, "yyyy")

       Dim sr1 As New System.IO.StreamReader(day + month + year + ext)
       Dim Line1 As Object
       Dim space1 As Object = "	"
       Dim enter1 As Object
       Line1 = sr1.ReadToEnd
       sr1.Close()
       vals = Line1.Split(space1)
       TextBox1.Text = vals(3) + vbCrLf + vals(5) + vbCrLf + vals(7)

 

I tried to load other file "23102003.txt" by subtracting the day value with one, two, three...but is not working. Can't subtract from string.

 

Any ideas?

Posted

To subtract from String you just have to convert the string into a number with CType.

 

But in this case I think you want to convert it into a Date Format.

Just put a "-" on the string separating day, month & year and CType it to a Date Format... Then you can subtract the days correectly

Software bugs are impossible to detect by anybody except the end user.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...