i have a problem with VisualBasic6 .
i have 3 Textbox and 2 Command Button .
i want to detect VbCrLf when checking first textbox , letter by letter then write in another in second textbox: 101 and another function check the second textbox , if found 101 then make a new line (vbcrlf) in the third textbox.
in a Command :
For i = 1 to len(text1.text)
if Mid(txtD.Text, i, 1) = vbcrlf then
text2.text = 101
endif
next
in Command2 :
if text2.text = 101 then
text3.text = text3.text & vbcrlf
endif
but when i check for Vbcrlf , it seem that character is not a newline-character and text2.text doesn't fill 101
Also i tried VbNewLine but there is same problem !
Thank You my friends !
You need to check exactly what the new line delimiter is. I have seen vbcr, vblf, & vbcrlf. VbNewLine is the same as vbcrlf.
Also, even if you do have vbcrlf in your string, your test will still fail. vbcrlf is TWO characters. You're testing just one character at a time.
A better test would the InStr() function. This is a quick test to see if a smaller string is anywhere in the larger one. So, your test would look like this:
If InStr(txtD.Text, vbcr) or InStr(txtD.Text, vblf) then
text2.text = 101
End If