tags:

views:

106

answers:

5

In my VB application,I am copying huge amount of data using VB string? This results in performance issue. What shoul I use in place of VB string to improve performance?

A: 

One way to solve this is to pre-allocate a byte/char array that is big enough to hold all your concatenated strings.

If you are using VB.NET, then there is the StringBuilder class.

Mitch Wheat
Size is not predefined
A: 

With VB 6 maybe this can help you out.

Greco
+2  A: 

Try to make sure you are always passing ByRef wherever possible (in VB6). In VB.Net this is not an issue. Also, maybe preallocate your strings. Analysis and a better description of your programming task can help provide a better answer.

1800 INFORMATION
+2  A: 

This two part article is good source of information for VB6. Some tips mentioned there are:

  • Use $ version of string functions (i.e. Replace$ instead of Replace).
  • Use LenB() to check if string is empty (or not).
  • Use vbNullString constant instead of "".
Grzegorz Gierlik
Thanks,I already implemented this
A: 

Did you try using a StringBuilder from .NET? It is marked as "COM Visible", which means you should be able to use it from VB 6.

Jonathan Allen