Click here to Skip to main content
15,918,967 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: datatype conversion problem when fetching fromn database Pin
Dave Kreskowiak7-May-09 10:00
mveDave Kreskowiak7-May-09 10:00 
GeneralRe: datatype conversion problem when fetching fromn database Pin
Ankit Aneja7-May-09 11:02
Ankit Aneja7-May-09 11:02 
QuestionRAS option RASEO_RequireDataEncryption not work Pin
xmen3317-May-09 5:33
xmen3317-May-09 5:33 
AnswerRe: RAS option RASEO_RequireDataEncryption not work Pin
Dave Kreskowiak7-May-09 6:03
mveDave Kreskowiak7-May-09 6:03 
QuestionOpen all files in a Folder Pin
vijay24827-May-09 5:05
vijay24827-May-09 5:05 
AnswerRe: Open all files in a Folder Pin
Dave Kreskowiak7-May-09 5:32
mveDave Kreskowiak7-May-09 5:32 
AnswerRe: Open all files in a Folder Pin
riced7-May-09 6:58
riced7-May-09 6:58 
AnswerRe: Open all files in a Folder Pin
riced7-May-09 8:46
riced7-May-09 8:46 
Here's a possible solution assuming you want to do it in AppendFiles(). Check the names in GetMaxColPos I'm not sure they're correct.
   Private Sub AppendFiles(ByVal inputPath As String, ByVal outputFile As String)
      Dim columnPositions(10) As Integer
      Dim theDir As DirectoryInfo = New DirectoryInfo(inputPath)
      Dim theFiles As FileInfo() = theDir.GetFiles("*.txt")
      Dim doHeaders As Boolean = Not File.Exists(outputFile)
      Dim maxColPos(10) As Integer

      Call GetMaxColPos(maxColPos, theFiles)
      Using sw As StreamWriter = New StreamWriter(outputFile, True, System.Text.Encoding.Default)
           ....... 
               'Now read and write the data lines   
               While sr.Peek() >= 0
                  inputLine = sr.ReadLine()
                  outputLine = GetOutputLine(inputLine, createdAt, maxColPos)
                  sw.WriteLine(outputLine)
               End While
            End Using
         Next fileCount
      End Using
   End Sub

   Private Sub GetMaxColPos(ByVal p As Integer(), ByVal files As FileInfo())
      Dim inLine As String
      Dim fieldLen As Integer
      For Each fi As FileInfo In files
         Using sr As StreamReader = New StreamReader(fi.FullName(), System.Text.Encoding.Default)
            inLine = sr.ReadLine()
            fieldLen = inLine.IndexOf("Nom du Modèle")
            If (fieldLen > p(0)) Then p(0) = fieldLen
            fieldLen = inLine.IndexOf("AEC_COMPATIBILITY")
            If (fieldLen > p(1)) Then p(1) = fieldLen
            fieldLen = inLine.IndexOf("AEC_STANDARD_DESCRIPTION_FRENCH")
            If (fieldLen > p(2)) Then p(2) = fieldLen
            fieldLen = inLine.IndexOf("AEC_FREE_DESCRIPTION_FRENCH")
            If (fieldLen > p(3)) Then p(3) = fieldLen
            fieldLen = inLine.IndexOf("AWW_STANDARD_DESCRIPTION")
            If (fieldLen > p(4)) Then p(4) = fieldLen
            fieldLen = inLine.IndexOf("AEC_FREE_DESCRIPTION_ENGLISH")
            If (fieldLen > p(5)) Then p(5) = fieldLen
            fieldLen = inLine.IndexOf("AEC_ECN")
            If (fieldLen > p(6)) Then p(6) = fieldLen
            fieldLen = inLine.IndexOf("DNF")
            If (fieldLen > p(7)) Then p(7) = fieldLen
            fieldLen = inLine.IndexOf("REP_DNF")
            If (fieldLen > p(8)) Then p(8) = fieldLen
            fieldLen = inLine.IndexOf("REP_ASM")
            If (fieldLen > p(9)) Then p(9) = fieldLen
         End Using
      Next
   End Sub


Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis

GeneralMessage Closed Pin
7-May-09 11:37
vijay24827-May-09 11:37 
GeneralRe: Open all files in a Folder Pin
riced7-May-09 12:22
riced7-May-09 12:22 
GeneralMessage Closed Pin
8-May-09 0:42
vijay24828-May-09 0:42 
GeneralRe: Open all files in a Folder Pin
riced9-May-09 1:18
riced9-May-09 1:18 
GeneralRe: Open all files in a Folder Pin
vijay24829-May-09 3:02
vijay24829-May-09 3:02 
QuestionDataGridView CheckBox column Pin
Paul McGann7-May-09 5:00
professionalPaul McGann7-May-09 5:00 
AnswerRe: DataGridView CheckBox column Pin
Henry Minute7-May-09 11:28
Henry Minute7-May-09 11:28 
GeneralRe: DataGridView CheckBox column Pin
Paul McGann7-May-09 13:08
professionalPaul McGann7-May-09 13:08 
GeneralRe: DataGridView CheckBox column Pin
Henry Minute8-May-09 1:57
Henry Minute8-May-09 1:57 
GeneralRe: DataGridView CheckBox column Pin
Paul McGann8-May-09 3:10
professionalPaul McGann8-May-09 3:10 
QuestionProblem with sstab control in vb 6.0 Pin
Member 30578877-May-09 3:53
Member 30578877-May-09 3:53 
AnswerRe: Problem with sstab control in vb 6.0 Pin
Tom Deketelaere7-May-09 4:19
professionalTom Deketelaere7-May-09 4:19 
AnswerRe: Problem with sstab control in vb 6.0 [modified] Pin
Dalek Dave7-May-09 4:30
professionalDalek Dave7-May-09 4:30 
AnswerRe: Problem with sstab control in vb 6.0 Pin
Dave Kreskowiak7-May-09 5:30
mveDave Kreskowiak7-May-09 5:30 
GeneralRe: Problem with sstab control in vb 6.0 Pin
Member 30578877-May-09 18:57
Member 30578877-May-09 18:57 
GeneralRe: Problem with sstab control in vb 6.0 Pin
Dave Kreskowiak8-May-09 0:29
mveDave Kreskowiak8-May-09 0:29 
AnswerRe: Problem with sstab control in vb 6.0 Pin
DidiKunz8-May-09 11:24
DidiKunz8-May-09 11:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.