-
I hope I can explain this correctly.
I have a text box that a user can type in a message with multipul lines. Then save this message for another time to a text file. When I load the message back to the text box from the file using a string, I get visual Enters (small black rectangles) not carriage returns on the text box. How do I get the text box to go to the next line instead of showing the damn black retangles.
I hope this makes sense.
Thanks
-
How does you save and load the file?
Have you set MultiLine to true for the textbox?
-
Code:
'Save
If msgTitle = "" Then Exit Sub
Open FilePath & FileName For Append As #1
Print #1, "[Title]= " & msgTitle
Print #1, "[Message]= " & outMsg
Close #1
'Open
Open FilePath & FileName For Input As #1
While Not EOF(1)
Input #1, strTemp
If InStr(strTemp, "[Title]=") <> 0 Then
If Not Looking Then
SavedMsg(Count).strTitle = Mid(strTemp, 10, Len(strTemp))
Looking = True
Else
Count = Count + 1
SavedMsg(Count).strTitle = Mid(strTemp, 10, Len(strTemp))
End If
ReDim Preserve SavedMsg(Count + 1)
ElseIf Looking Then
If InStr(strTemp, "[Message]=") <> 0 Then
SavedMsg(Count).strMsg = Mid(strTemp, 12, Len(strTemp))
Else
If SavedMsg(Count).strMsg <> "" Then
SavedMsg(Count).strMsg = SavedMsg(Count).strMsg & Chr(13) & strTemp
End If
End If
End If
Wend
Close #1
txtmsg.text = SavedMsg(1).strMsg
Yes I do Have multi lines on. It looks fine when you type it and in the text file. So it has to be in the load or the writing to the text box
-
Use Line Input # instead of Input # and change Chr(13) to vbCrLf.
Good luck!
-