|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I see that a lot of experts are able to answer of many questions in this site. I try to make a dynamic Listview and I have a small problem with For Each xxx. My problem is to push the data in dynamic way. Every worker(string) has a directory with 12 files all months. My wish is to take the information’s from those 12 files without erasing of data form the first worker, the code that I wrote erase every time the data from other worker and it keeps only from the last one. Private Sub entreprises(ByVal word As String) Dim worker As String Dim Temp As New FileStream(Application.StartupPath & "\Save\test.txt", FileMode.Open) 'take information’s from file test.txt Dim Temp_Stream As New StreamReader(Temp) ' Do Until Temp_Stream.Peek = -1 Val = Temp_Stream.ReadLine.Split("|") 'Separator between the names For i = 1 To Val.Length - 1 worker = Val(i - 1) 'One feet back if it goes to the end Next ' Loop ' Temp_Stream.Close() 'Fermeture du fichier Temp.Close() 'Fermeture du fichier Dim objAccount As AccountsClassLibrary.Account Dim objcont As AccountsClassLibrary.Account If m_Accounts.Count = 0 Then objAccount = New AccountsClassLibrary.Account objAccount.AccountName = "Janvier" Dim Fs_Janvier As New IO.FileStream(Application.StartupPath & "\Save\" & worker & "\Janvier.hor1", FileMode.Open) Dim Str_Janvier As New IO.StreamReader(Fs_Janvier) Do Until Str_Janvier.Peek = -1 Val = Str_Janvier.ReadLine.Split("|") If Val(2) = word Then objAccount.CodeListings.Add(Val(0), Val(1), Val(2), Val(3), Val(4)) 'So here all data are erased by the last worker !!! End If Loop m_Accounts.Add(objAccount) 'Add Str_Janvier.Close() Fs_Janvier.Close() . .. ... objAccount = New AccountsClassLibrary.Account objAccount.AccountName = "Décembre" Dim Fs_Février As New IO.FileStream(Application.StartupPath & "\Save\" & worker & "\Décembre.hor1", FileMode.Open) Dim Str_Décembre As New IO.StreamReader(Fs_Décembre) Do Until Str_Décembre.Peek = -1 Val = Str_Décembre.ReadLine.Split("|") If Val(2) = word Then objAccount.CodeListings.Add(Val(0), Val(1), Val(2), Val(3), Val(4)) End If Loop m_Accounts.Add(objAccount) Str_Février.Close() Fs_Février.Close() Me.TabControl.TabPages.Clear() For Each objAccount In m_Accounts Dim objTabPage As New TabPage(objAccount.AccountName) Dim objControl As New AccountsWindowsControlLibrary.UserControlAccounts objTabPage.Controls.Add(objControl) Me.TabControl.TabPages.Add(objTabPage) With objControl .Dock = DockStyle.Fill .Account = objAccount End With Next End If End Sub Thanks for you're help Naim |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Dynamic Listview |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|