Share via

VB6 program, connecting string-variables wrong result under Win 11

Rainer Wum 0 Reputation points
2023-12-15T17:08:28.53+00:00

Hi, my Visual Basic 6 programs are running under Win11.

Connecting strings is working properly:

txt = "abc" & "def"

The result is "abcdef"

BUT if I connect two string-variables the second part disappears.

tx1 = "abc"

tx2 = "def"

txt = tx1 & tx2

under Win 11 the result is only "abc".

Is there any other runtime library necessary or is there any other solution?

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. Viorel 127K Reputation points
    2023-12-16T06:17:29.32+00:00

    Probably the real tx1 or tx2 contains some special characters, such as vbNullChar or Chr(0).

    Try to fix the strings using something like tx1 = Replace(tx1, vbNullChar, " ").

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.