The issue is one of Scope
. In a nutshell in this case:
Private Sub txtSerialNumber_Leave(...
Dim printString As String = My.Resources.Fuel_Cell_Label
printString
is a local variable since you declare it (Dim
) inside a procedure. This creates a new one each time. To give it module level scope, just declare it outside any of the subs:
Dim printString As String =""
Private Sub txtSerialNumber_Leave....
' it will retain the
End Sub
Be sure that somewhere when logical you reset it to "" or it will keep accumulating. In that example you have no idea for sure which one they will leave or if they will re-enter the text, so you will need to rethink how you are doing that. Some sort of "OK" or "Done" button which calls a sub with the code from both those events would be one way.
More about Scope in Visual Basic