Code:Private Sub Form_Load () With RichTextBox1 .Text = "Welcome to the RichTextBox Sample Source Code!" .SelStart = 0 .SelLength = Len(.Text) .SelFontName = "Arial" .SelFontSize = 10 .SelAlignment = rtfCenter .SelStart = InStr(.Text, "RichTextBox") - 1 .SelLength = Len("RichTextBox") .SelFontName = "Courier New" .SelColor = vbBlue .SelStart = InStr(.Text, "Sample Source Code") - 1 .SelLength = 4 .SelFontName = "Courier New" .SelUnderline = True .SelStart = .SelStart + 1 .SelLength = 1 .SelColor = vbRed .SelStart = .SelStart + 1 .SelLength = 1 .SelColor = vbBlue .SelStart = .SelStart + 1 .SelLength = 1 .SelColor = vbGreen .SelStart = 0 .SelLength = 0 End With End Sub




Reply With Quote