PLease help, problems with selstart & sellength not working as expected (1 Viewer)

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
 

seth_belgium

WoW-Addict
Local time
Today, 14:14
Joined
Oct 4, 2005
Messages
175
I think I got it, just take a look at the attached database.

Greetz,

Seth
 

Attachments

  • Add Tags To Selected Text.zip
    18.1 KB · Views: 197
W

wim_007

Guest
Thank you very much!

seth_belgium, thank you very much! :)

Your code works great!

It seem that my problem was somewhere with assigning of the selstart / sellength values. I'm not used to programming in Access anymore.

I just subcribed myself to this forum hoping that somebody could help like you did. Thanks again, you're the best!

Take care!
 

Users who are viewing this thread

Top Bottom