Click here to Skip to main content
15,893,722 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Automatically open chat window Pin
Christian Graus17-Mar-09 20:04
protectorChristian Graus17-Mar-09 20:04 
GeneralRe: Automatically open chat window Pin
Gagan.2017-Mar-09 20:31
Gagan.2017-Mar-09 20:31 
GeneralRe: Automatically open chat window Pin
Christian Graus17-Mar-09 20:33
protectorChristian Graus17-Mar-09 20:33 
GeneralRe: Automatically open chat window Pin
Gagan.2018-Mar-09 4:47
Gagan.2018-Mar-09 4:47 
Questionrecording sound from mic in VB.NET Pin
shark_scott17-Mar-09 17:34
shark_scott17-Mar-09 17:34 
QuestionPassing hIcons to WinAPI Pin
o m n i17-Mar-09 15:25
o m n i17-Mar-09 15:25 
AnswerRe: Passing hIcons to WinAPI Pin
Dave Kreskowiak18-Mar-09 6:38
mveDave Kreskowiak18-Mar-09 6:38 
QuestionProcessing Very Large Lists Pin
Alan Burkhart17-Mar-09 12:15
Alan Burkhart17-Mar-09 12:15 
A VB.net app I'm building needs to process very long lists stored in .txt files. My problem occurs when I attempt to avoid duplicate entries while merging lists. Most of the lists go quickly, but the largest (the largest to date has 190,000 lines) take forever. I don't expect that much data to process instantly, but I would like to speed things up. Here's how I'm doing it at present:

' "lbSelFiles" is the listbox containing paths to the files to be processed.
    ' the "sr" streamreader reads each line of each file. If the line isn't already
    'in the collection (addList), it adds it.
    ' The "getLines" array's only purpose is to provide a max value for the progress bar (progBar).

    addList.Clear()

    For l = 0 To lbSelFiles.Items.Count - 1
      If File.Exists(lbSelFiles.Items.Item(l).ToString) Then
        Dim getLines() As String = File.ReadAllLines(lbSelFiles.Items.Item(l).ToString)
        progBar.Maximum = getLines.Length
        progBar.Value = 0
        Dim sr As New StreamReader(lbSelFiles.Items.Item(l).ToString)

        Dim line As String
        Do
          line = sr.ReadLine()
          'this appears to be the bottle neck
          If Not addList.Contains(line) Then
            addList.Add(line)
          End If
          progBar.Increment(1)
        Loop Until line Is Nothing
        sr.Close()
      End If

    Next l

    'this copies addList to an array, then sends the array to a richtextbox
    'the form containing this code then closes
    Dim arr(addList.Count) As String
    addList.CopyTo(arr, 0)
    Dim newRTF As RichTextBox = CType(main.ActiveMdiChild.Controls(0), RichTextBox)
    newRTF.Lines = arr
    Me.Close()


Any suggestions on a better (faster) way are appreciated.
AnswerRe: Processing Very Large Lists Pin
Christian Graus17-Mar-09 12:22
protectorChristian Graus17-Mar-09 12:22 
AnswerRe: Processing Very Large Lists Pin
supercat917-Mar-09 12:56
supercat917-Mar-09 12:56 
AnswerRe: Processing Very Large Lists Pin
Alan Burkhart17-Mar-09 13:17
Alan Burkhart17-Mar-09 13:17 
AnswerRe: Processing Very Large Lists Pin
Luc Pattyn17-Mar-09 15:03
sitebuilderLuc Pattyn17-Mar-09 15:03 
GeneralRe: Processing Very Large Lists Pin
Alan Burkhart17-Mar-09 16:18
Alan Burkhart17-Mar-09 16:18 
QuestionMS Word Automation [modified] correct and/or add styles to an existing document using template ???? Pin
Amr M. K.17-Mar-09 12:08
Amr M. K.17-Mar-09 12:08 
Questionunable to get result back from unmanaged code Pin
Bjorn Tore17-Mar-09 11:32
Bjorn Tore17-Mar-09 11:32 
AnswerRe: unable to get result back from unmanaged code Pin
Christian Graus17-Mar-09 11:57
protectorChristian Graus17-Mar-09 11:57 
QuestionRestoring bac the server Pin
jishbalan17-Mar-09 6:35
jishbalan17-Mar-09 6:35 
AnswerRe: Restoring bac the server Pin
0x3c017-Mar-09 7:13
0x3c017-Mar-09 7:13 
QuestionChanging Audio Devices? Pin
SeeingBlue17-Mar-09 4:53
SeeingBlue17-Mar-09 4:53 
AnswerRe: Changing Audio Devices? Pin
dan!sh 17-Mar-09 5:14
professional dan!sh 17-Mar-09 5:14 
AnswerRe: Changing Audio Devices? Pin
Xmen Real 17-Mar-09 5:43
professional Xmen Real 17-Mar-09 5:43 
QuestionHow could you check a node in treeview whenever a child node gets checked? Pin
JUNEYT17-Mar-09 4:21
JUNEYT17-Mar-09 4:21 
AnswerRe: How could you check a node in treeview whenever a child node gets checked? Pin
Eddy Vluggen17-Mar-09 4:46
professionalEddy Vluggen17-Mar-09 4:46 
AnswerRe: How could you check a node in treeview whenever a child node gets checked? Pin
Xmen Real 17-Mar-09 6:29
professional Xmen Real 17-Mar-09 6:29 
QuestionWord.Application() not defined? Pin
Speedular17-Mar-09 4:00
Speedular17-Mar-09 4:00 

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.