Click here to Skip to main content
15,887,683 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: can't write all text to txt file Pin
TheMrProgrammer24-Jun-09 4:25
TheMrProgrammer24-Jun-09 4:25 
GeneralRe: can't write all text to txt file Pin
Christian Graus24-Jun-09 10:41
protectorChristian Graus24-Jun-09 10:41 
GeneralRe: can't write all text to txt file Pin
TheMrProgrammer24-Jun-09 19:51
TheMrProgrammer24-Jun-09 19:51 
AnswerRe: can't write all text to txt file Pin
Luc Pattyn24-Jun-09 13:34
sitebuilderLuc Pattyn24-Jun-09 13:34 
GeneralRe: can't write all text to txt file Pin
TheMrProgrammer24-Jun-09 19:55
TheMrProgrammer24-Jun-09 19:55 
GeneralRe: can't write all text to txt file Pin
Luc Pattyn24-Jun-09 23:29
sitebuilderLuc Pattyn24-Jun-09 23:29 
GeneralRe: can't write all text to txt file Pin
TheMrProgrammer25-Jun-09 3:37
TheMrProgrammer25-Jun-09 3:37 
GeneralRe: can't write all text to txt file Pin
Luc Pattyn25-Jun-09 3:51
sitebuilderLuc Pattyn25-Jun-09 3:51 
TheMrProgrammer wrote:
For x = 0 to listbox1.Items.Count-1
strVar &= listbox1.Items(x).ToString
Next


for counts of many tenthousands, this is non-seense: the final result would probably be a string with a length exceeding one million characters, however building it also creates tenthousands of intermediate strings of growing length, so your code is bound to be extremely slow, and may well run out of memory.

furthermore, there was no need whatsoever to concatenate everything, since File class also has a WriteAllLines() method, which takes an array of strings.

finally, if you do not absolutely need to hold lots of data in memory, then don't. Just write the text lines as you get them. I know you are failing here so far, due to reasons unknown to all of us as you still haven't shown us real code. Lacking that, I will not continue this thread.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.

QuestionHexadecimal const declare Pin
garfield18523-Jun-09 21:32
garfield18523-Jun-09 21:32 
AnswerRe: Hexadecimal const declare Pin
Christian Graus23-Jun-09 21:38
protectorChristian Graus23-Jun-09 21:38 
AnswerRe: Hexadecimal const declare Pin
JoeSharp23-Jun-09 22:03
JoeSharp23-Jun-09 22:03 
GeneralRe: Hexadecimal const declare Pin
garfield18523-Jun-09 22:11
garfield18523-Jun-09 22:11 
Questionhow to start a project Pin
shivam jaitly23-Jun-09 21:32
shivam jaitly23-Jun-09 21:32 
AnswerRe: how to start a project Pin
Christian Graus23-Jun-09 21:38
protectorChristian Graus23-Jun-09 21:38 
AnswerRe: how to start a project Pin
Dave Kreskowiak24-Jun-09 4:12
mveDave Kreskowiak24-Jun-09 4:12 
AnswerRe: how to start a project Pin
Jon_Boy24-Jun-09 4:18
Jon_Boy24-Jun-09 4:18 
GeneralRe: how to start a project Pin
scottgp24-Jun-09 5:24
professionalscottgp24-Jun-09 5:24 
GeneralRe: how to start a project Pin
Jon_Boy24-Jun-09 6:33
Jon_Boy24-Jun-09 6:33 
QuestionDHTMLEdit and Font color Pin
kof_fans23-Jun-09 20:58
kof_fans23-Jun-09 20:58 
AnswerRe: DHTMLEdit and Font color Pin
Aman Bhullar23-Jun-09 21:22
Aman Bhullar23-Jun-09 21:22 
GeneralRe: DHTMLEdit and Font color Pin
kof_fans23-Jun-09 21:28
kof_fans23-Jun-09 21:28 
QuestionHow Can I Open myFile Format With My Created Program [modified] Pin
rostam2023-Jun-09 18:45
rostam2023-Jun-09 18:45 
AnswerRe: How Can I Open myFile Format With My Created Program Pin
_Damian S_23-Jun-09 20:12
professional_Damian S_23-Jun-09 20:12 
AnswerRe: How Can I Open myFile Format With My Created Program Pin
Luc Pattyn23-Jun-09 21:27
sitebuilderLuc Pattyn23-Jun-09 21:27 
QuestionChange startup dir Pin
cstrader23223-Jun-09 15:58
cstrader23223-Jun-09 15:58 

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.