Probaj Ovako
Koristio sam jedan RichTextBox koji sam imenovao sa RTB1.
1:
U KeyPress Event RTB1 ubaci ovaj kod
Code:
Dim L As Long
Dim S As String
Dim S1 As String
Const strDodaj = " ()" & vbCrLf & " {" & vbCrLf & " }"
If KeyAscii = 32 Then
S = Right(RTB1.Text, 2)
S1 = LCase(S)
If S1 = "if" Then
RTB1.Text = RTB1.Text & strDodaj
L = Len(RTB1.Text)
RTB1.SelStart = Len(RTB1.Text) - 9
End If
End If
2:
Code:
Const Crvena = &HFF&
Const Plava = &HFF0000
Const Zuta = &HFFFF&
Const Zelena = &HFF00&
RTB1.SelColor = Crvena
3:
u General Forme deklarisi promjenjivu strSelText i definisi je kao string.
U RTB1_KeyDown ubaci sledeci kod:
Code:
Dim S As String
Dim I As Integer
If KeyCode = 9 Then
S = RTB1.SelText
If Len(S) > 0 Then
strSelText = S
Else
strSelText = ""
End If
End If
a u RTB1_KeyUp ubaci:
Code:
If KeyCode = 9 Then
RTB1.SelText = strSelText
End If
_______________________________________
Ero