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
 
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 (Users: 0, Guests: 1)

Top Bottom