W
wim_007
Guest
The following code should put <B> </B> arround the text selected in a textbox. It works fine on the first liner of the text, but not when the text has enters in it. The functions SelStart and Slelength do not seem to take enters in their calculation.... The code I use is listed below. Please help:
Code:
Dim intSelStart As Integer
Dim intSelLength As Integer
Dim strBeschrijving As String
Dim strBeschrijvingHulp As String
Dim strDeel1 As String
Dim strDeel2 As String
Dim strDeel3 As String
txtBeschrijving.SetFocus
strBeschrijving = txtBeschrijving.Text
intSelStart = txtBeschrijving.SelStart
intSelLength = txtBeschrijving.SelLength
strDeel1 = Mid$(strBeschrijving, 1, intSelStart)
strDeel2 = Mid$(strBeschrijving, intSelStart + 1, intSelLength)
strDeel3 = Mid$(strBeschrijving, intSelStart + intSelLength + 1, Len(strBeschrijving))
Form_frmProducten.txtBeschrijving.Text = strDeel1 & "<B>" & strDeel2 & "</B>" & strDeel3