VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



VB TEXTPAD APPLICATION

by Chirantan Bhattacharjee (6 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 4th December 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

VB TEXTPAD APPLICATION

Rate VB TEXTPAD APPLICATION




Private Sub Combo1_click()
Me.RichTextBox1.SelFontName = Me.Combo1.Text
Me.RichTextBox1.SetFocus
End Sub

Private Sub Combo2_click()
Me.RichTextBox1.SelFontSize = Me.Combo2.Text
Me.RichTextBox1.SetFocus
End Sub

Private Sub Combo3_click()
Me.RichTextBox1.SelAlignment = Left(Me.Combo3.Text, 1)
Me.RichTextBox1.SetFocus
End Sub

Private Sub Command1_Click()
If Me.RichTextBox1.SelBold = True Then
    Me.RichTextBox1.SelBold = False
    Me.Command1.BackColor = vbButtonFace
Else
    Me.Command1.BackColor = &HC0FFFF
    Me.RichTextBox1.SelBold = True
End If
Me.RichTextBox1.SetFocus
End Sub

Private Sub Command10_Click()
Me.Frame1.Visible = True
Me.Shape1.Visible = True
Me.Label1.Visible = True
End Sub

Private Sub Command11_Click()
Form4.Show
End Sub

Private Sub Command2_Click()
If Me.RichTextBox1.SelUnderline = True Then
    Me.RichTextBox1.SelUnderline = False
    Me.Command2.BackColor = vbButtonFace
Else
    Me.RichTextBox1.SelUnderline = True
    Me.Command2.BackColor = &HC0FFFF
End If
Me.RichTextBox1.SetFocus
End Sub

Private Sub Command3_Click()
If Me.RichTextBox1.SelItalic = True Then
    Me.RichTextBox1.SelItalic = False
    Me.Command3.BackColor = vbButtonFace
Else
    Me.RichTextBox1.SelItalic = True
    Me.Command3.BackColor = &HC0FFFF
End If
Me.RichTextBox1.SetFocus
End Sub

Private Sub Command4_Click()
sve
End Sub

'Private Sub Command4_Click()
'Me.CommonDialog1.ShowColor
'Me.RichTextBox1.BackColor = Me.CommonDialog1.Color
'End Sub

Private Sub Command5_Click()
Me.CommonDialog1.ShowColor
Me.RichTextBox1.SelColor = Me.CommonDialog1.Color
Me.RichTextBox1.SetFocus
End Sub

Private Sub Command6_Click()
'Me.RichTextBox1.SaveFile sFile
End Sub

Private Sub Command7_Click()
opn
Me.RichTextBox1.SetFocus
End Sub

Private Sub Command8_Click()
Dim x As Integer
If Me.RichTextBox1.Text = "" Then
    Me.RichTextBox1.SetFocus
    Me.RichTextBox1.SelBold = False
    Me.RichTextBox1.SelAlignment = 0
    Me.RichTextBox1.SelColor = vbBlack
    Me.RichTextBox1.SelFontName = "Microsoft Sans Serif"
    Me.RichTextBox1.SelFontSize = "9"
    Me.RichTextBox1.SelItalic = False
    Me.RichTextBox1.SelUnderline = False
Else
    x = MsgBox("Do you want to save the existing text ?", vbExclamation + vbYesNoCancel, "Message")
    If x = 6 Then
        sve
        Me.RichTextBox1.Text = ""
        Me.RichTextBox1.SetFocus
        Me.RichTextBox1.SelBold = False
        Me.RichTextBox1.SelAlignment = 0
        Me.RichTextBox1.SelColor = vbBlack
        Me.RichTextBox1.SelFontName = "Microsoft Sans Serif"
        Me.RichTextBox1.SelFontSize = "9"
        Me.RichTextBox1.SelItalic = False
        Me.RichTextBox1.SelUnderline = False
    ElseIf x = 7 Then
        Me.RichTextBox1.Text = ""
        Me.RichTextBox1.SetFocus
        Me.RichTextBox1.SelBold = False
        Me.RichTextBox1.SelAlignment = 0
        Me.RichTextBox1.SelColor = vbBlack
        Me.RichTextBox1.SelFontName = "Microsoft Sans Serif"
        Me.RichTextBox1.SelFontSize = "9"
        Me.RichTextBox1.SelItalic = False
        Me.RichTextBox1.SelUnderline = False
    ElseIf x = 2 Then
        Me.RichTextBox1.SetFocus
    End If
End If
End Sub

Private Sub Command9_Click()
Dim y As Integer
If Me.RichTextBox1.Text = "" Then
    End
Else
    y = MsgBox("Do you want to save the existing text ?", vbExclamation + vbYesNoCancel, "Message")
    If y = 6 Then
        sve
        End
    ElseIf y = 7 Then
        End
    ElseIf y = 2 Then
        Me.RichTextBox1.SetFocus
    End If
End If
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 27 Then
    Me.Frame1.Visible = False
    Me.Shape1.Visible = False
    Me.Label1.Visible = False
End If
End Sub

Private Sub Form_Load()
ch = 0
Me.RichTextBox1.Text = ""
Me.Combo1.AddItem "Arial"
Me.Combo1.AddItem "Arial Black"
Me.Combo1.AddItem "Arial Narrow"
Me.Combo1.AddItem "Bradley Hand Itc"
Me.Combo1.AddItem "Calisto MT"
Me.Combo1.AddItem "Castellar"
Me.Combo1.AddItem "Century Gothic"
Me.Combo1.AddItem "Century Schoolbook"
Me.Combo1.AddItem "Comic Sans MS"
Me.Combo1.AddItem "Copperplate Gothic Bold"
Me.Combo1.AddItem "Copperplate Gothic Light"
Me.Combo1.AddItem "Courier New"
Me.Combo1.AddItem "Eras Bold Itc"
Me.Combo1.AddItem "Fixedsys"
Me.Combo1.AddItem "Franklin Gothic Demi"
Me.Combo1.AddItem "Lucida Console"
Me.Combo1.AddItem "Microsoft Sans Serif"
Me.Combo1.AddItem "MS Reference Sans Serif"
Me.Combo1.AddItem "Tahoma"
Me.Combo1.AddItem "Terminal"
Me.Combo1.AddItem "Times New Roman"
Me.Combo1.AddItem "Trebuchet MS"
Me.Combo1.AddItem "Tw Cen MT"
Me.Combo1.AddItem "Verdana"
Me.Combo3.AddItem "0-Left Justified"
Me.Combo3.AddItem "1-Right Justified"
Me.Combo3.AddItem "2-Centre"
Me.Combo2.AddItem "8"
Me.Combo2.AddItem "9"
Me.Combo2.AddItem "10"
Me.Combo2.AddItem "11"
Me.Combo2.AddItem "12"
Me.Combo2.AddItem "14"
Me.Combo2.AddItem "16"
If Me.RichTextBox1.Text = "" Then
    Me.Command10.Enabled = False
Else
    Me.Command10.Enabled = True
End If
End Sub
Public Sub sve()
Dim sFile As String
With Me.CommonDialog1
        .DialogTitle = "Save As"
        .CancelError = False
        '.DefaultExt = "*.rtf"
        'ToDo: set the flags and attributes of the common dialog control
        .DefaultExt = "*.z"
        .Filter = "All Files (*.*)|*.z"
        .ShowSave
        If Len(.FileName) = 0 Then
            Exit Sub
        End If
        sFile = .FileName
End With
    
    'Form1.Caption = sFile
    form1.RichTextBox1.SaveFile sFile
End Sub
Public Sub opn()
Dim sFile As String
      With Me.CommonDialog1
        .DialogTitle = "Open"
        .CancelError = False
        'ToDo: set the flags and attributes of the common dialog control
        .Filter = "All Files (*.*)|*.*"
        .ShowOpen
        If Len(.FileName) = 0 Then
            Exit Sub
        End If
        sFile = .FileName
End With
    form1.RichTextBox1.LoadFile sFile
End Sub


Private Sub Form_Unload(Cancel As Integer)
Dim m As Integer
If Cancel = 0 Then
    If Me.RichTextBox1.Text = "" Then
        End
    Else
        m = MsgBox("Do you want to save the existing text ?", vbExclamation + vbYesNo, "Save Confirmation")
        If m = 6 Then
            sve
            End
        ElseIf m = 7 Then
            End
        'ElseIf m = 2 Then
        '    form1.Show
        '    Me.RichTextBox1.SetFocus
        End If
    End If
End If
End Sub

Private Sub Option1_Click()
Me.Label1.Caption = "Characters = " + CStr(Len(Me.RichTextBox1.Text) - (ch * 2))
End Sub


Private Sub Option2_Click()
Me.Label1.Caption = "Words = "
End Sub

Private Sub Option3_Click()
Me.Label1.Caption = "Paragraphs = "
End Sub

Private Sub RichTextBox1_Change()
If Me.RichTextBox1.Text = "" Then
    Me.Command10.Enabled = False
Else
    Me.Command10.Enabled = True
End If
End Sub

Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)
If Me.RichTextBox1.Text = "" Then
    ch = 0
End If
If KeyAscii = 13 Then
    ch = ch + 1
ElseIf KeyAscii = 8 Then
    ch = ch - 1
End If
End Sub

'Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
'If KeyCode = 17 And KeyCode = 66 Then
'    If Me.RichTextBox1.SelBold = True Then
'        Me.RichTextBox1.SelBold = False
'    Else
'        Me.RichTextBox1.SelBold = True
'    End If

'End If
'End Sub


Private Sub RichTextBox1_SelChange()
Dim x As Integer
On Error GoTo err:
Me.Combo1.Text = Me.RichTextBox1.SelFontName
Me.Combo2.Text = Me.RichTextBox1.SelFontSize
x = Me.RichTextBox1.SelAlignment
If x = 0 Then
    Me.Combo3.Text = "0-Left Justified"
ElseIf x = 1 Then
    Me.Combo3.Text = "1-Right Justified"
Else
    Me.Combo3.Text = "2-Centre"
End If
If Me.RichTextBox1.SelBold = True Then
    Me.Command1.BackColor = &HC0FFFF
Else
    Me.Command1.BackColor = &H8000000F
End If
If Me.RichTextBox1.SelUnderline = True Then
    Me.Command2.BackColor = &HC0FFFF
Else
    Me.Command2.BackColor = &H8000000F
End If
If Me.RichTextBox1.SelItalic = True Then
    Me.Command3.BackColor = &HC0FFFF
Else
    Me.Command3.BackColor = &H8000000F
End If
Exit Sub
err:
    Me.Combo1.Text = ""
    Me.Combo2.Text = ""
    Me.Combo3.Text = ""
End Sub



'make sure all the controls are taken in the form.
'Please reply how you like our service
'Please reply to [email protected]


Download this snippet    Add to My Saved Code

VB TEXTPAD APPLICATION Comments

No comments have been posted about VB TEXTPAD APPLICATION. Why not be the first to post a comment about VB TEXTPAD APPLICATION.

Post your comment

Subject:
Message:
0/1000 characters