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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.