Results 1 to 3 of 3

Thread: insert cursor? [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353

    insert cursor? [RESOLVED]

    How do I have the cursor be at the end of the date after it is inserted?

    VB Code:
    1. If e.KeyCode = Keys.D And e.Control = True Then
    2.             Dim Ref As RichTextBox = sender
    3.             Ref.Text = Ref.Text.Insert(Ref.SelectionStart, Date.Today)
    4.         End If

    Brenda
    Last edited by brendalisalowe; Sep 3rd, 2004 at 09:44 AM.

  2. #2
    Member skarho's Avatar
    Join Date
    Aug 2004
    Location
    Cebu, Philippines Occupation: Official Janitor SSS Contribution: 0 Pesos Certifications: None
    Posts
    53
    VB Code:
    1. Private Sub RichTextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyDown
    2.       If e.Control And e.KeyCode = Keys.D Then
    3.          Dim r As RichTextBox = CType(sender, RichTextBox)
    4.          Dim s As String = Date.Today.ToString
    5.          Dim i As Integer = r.SelectionStart
    6.          r.Text = r.Text.Insert(i, s)
    7.          r.SelectionStart = i + s.Length
    8.       End If
    9.    End Sub

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2004
    Location
    Utah, USA
    Posts
    353
    Thanks! It is perfect!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width