Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have this code and I want to load seven different files for extracting some values from those files.

 

Right now I can load a file named after the current day.

30102003.doz

 

I want in form load to call a function for loading all files from 24102203.doz to 30102003.doz (all the last seven days beginning with current day)

 

So..all I want is to build a function after my code here and sending some parameters for different files loading.

 

In the end, I need to have:

 

ex:

vals1(3) = 30

vals2(3) = 43

vals3(3) = 54

vals4(3) = 54

vals5(3) = 76

vals6(3) = 24

vals1(3) = 86

 

I tried some tricks with no good results : (

 

 

 

Public Sub zi_()


       Dim zile(6) As String
       Dim z As Date
       Dim zs As New TimeSpan

       For day As Integer = 0 To 6
           z = Date.Now
           zs = zs.FromDays(day)
           z = z.Subtract(zs)
           zile(day) = Format(z, "dd")
       Next


       Dim month_1 As String
       Dim year_1 As String
       Dim ext As String = ".doz"
       Dim cale As String = "doze\"


       month_1 = Format(Now, "MM")
       year_1 = Format(Now, "yyyy")

       cale_finala = cale + zile(0) + month_1 + year_1 + ext

       Dim sr1 As New System.IO.StreamReader(cale_finala)
       Dim Line1 As Object
       Dim space1 As Object = "	"
       Dim enter1 As Object
       Line1 = sr1.ReadToEnd
       sr1.Close()
       vals1 = Line1.Split(space1)

   End Sub

 

thanks

Posted

a little help here?

 

I�m fighting for a while with this code and can�t find a viable solution for my problem.

 

I still have those charts for the last seven days and the last six months.

 

All I made by know is to have this chart displayed but with this problem:

 

I load for each value from the chart a single value from one text file.

 

So, if current day is 20 I load:

20102003.doz

19102003.doz

18102003.doz

17102003.doz

16102003.doz

15102003.doz

14102003.doz

 

In those case all looks perfect�but the problem occurs when the current day is, let�s say..6 Nov 2003.

In this case I need to load this files:

06112003.doz

05112003.doz

04112003.doz

03112003.doz

02112003.doz

01112003.doz

31102003.doz

 

 

You see the problem? After I made my day subtraction the app is trying to load this file: 31112003.doz. The code I write can�t know the month is over and need to subtract the month to load the �31102003.doz�

 

Of course the problem will appear when I will display the month charts in January.

 

So, please if anybody can help me with this, I will be grateful.

 

Thanks

Posted

thanks

 

Thank you, is working now.

 

Anybody has an idea how to load several text files.

 

I have those daily files and I want to extract a value from each file of one month to calculate a medium value for a chart.

 

Ex:

 

If I want to see the medium value for October, I need to load all 31 files and to extract a specific value from each file (10,50,20,50,etc) and after that to add them and calculate the medium value like (10+50+20+50+..+n)/31 and this value to put in my chart.

 

I tried a loop code but no success with that.

 

Thanks

Posted

load multiple files ??

 

hi again.

 

Nobody knows how to load multiple files to an array?

 

I whant just a simple code for loading the 3 files into an array. I will make the rest by myself, but I can't make this work :(

 

thanks

Posted

I made my loading for all the files I need, but the problems is how I can put my info from the files into separate variables ?

 

This because as you can see for put the info into ziua1 but when the next cicle ocur I will loose the previous data.

 

How I can make a separate variables for each file I open and read ?

 

thanks

 

Public Sub grafic_for(ByVal x)
       For i As Integer = 0 To x

           ziua = Format(DatTim1.AddDays(-i), "dd")
           month = Format(DatTim1.AddDays(-i), "MM")
           year = Format(DatTim1.AddDays(-i), "yyyy")

           cale_finala = cale + ziua + month + year + ext

           Dim my As IO.StreamReader
           my = IO.File.OpenText(cale_finala)
           Dim Line As Object
           Dim space1 As Object = "	"
           Dim enter1 As Object
           Line = my.ReadToEnd
           my.Close()
           ziua1 = Line.Split(space1)
           

       Next
   End Sub

Posted

I myself have never loaded more than one file, but I heard it schould be possible by this little Listing:

 

Dim ff(x) as Integer

'x is the number of files you want to open

Dim i as Integer

 

For i = 0 to ff.GetUpperbound(0)

ff(i) = freefile()

FileOpen(ff(i), ....) 'I do not know all the parameters at the moment

Next

 

Via Wirteline(ff(i), ...) You can Add Values. Reading should work the same way. But I did not try yet.

 

Plesse regard this more as a hint than as the solution to your problem.

 

Voca

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...