Let me describe the problem first:
I have a TYPE statement with two variables(appname & dbname). They both are pointing to a global variable that sets the maximum length of each to 8(eight) characters each.
I am trying to print the values inside a listbox using ADDITEM and concatenating the two strings right after the ADDITEM. When the first string has eight characters it prints perfectly, but otherwise, it simply omits the second string and prints just the first one.
My guess is that the empty spaces or the NULL CHARACTER are blocking the statement to read whatever comes after the first string, but the TRIM statement is not working and I cannot lower the number of characters assigned to them. Each string is assigned 8 characters including the NULL CHARACTER.
An easy way to fix this would be to use the Replace function (VB 6) to search the string and replace all Chr(0) characters with spaces, or some other insignificant character. If you don’t have the Replace function, do this:
Dim strSource As String ' original valueDim strReplace As String ' new, cleaned stringFor i = 1 To Len(strSource) If Mid(strSource, i, 1) = Chr(0) Then strReplace = strReplace & " " Else strReplace = strReplace & Mid(strSource, i, 1) End IfNext i