0

Hi,

I have written a code in VB which replaces comma(,) in a file with semicolon(;).
The syntax is
snextline = Replace(Inline, ",", ";")
where inline is the string which needs to be replaced.

Is there any way that i can show the progress using progress bar for the replacement of huge strings.

Please provide the code snippet if any.

Many thanks in advance guys.

Ashish

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Duoas
0

Your string needs to be pretty darn huge before you'll need to play with a progress bar.

So, first check the length of the string. If it is less than, say, 3000 characters, don't bother: just use the Replace function as you have it.

If it is larger, you'll need to
1. initialize the progress bar
2. search for the character to replace and replace it in a loop (that is, do it yourself!)
3. every time you have scanned over specific number of characters (say 1-2 thousand) update the progress bar, and defer to the window proc to process events for a moment.
4. finish.

You can stick your progress bar in a modal popup window (make sure it has a cancel button!) if you like. Display the window in step 1 and hide it in step 4.

Hope this makes sense.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.