Results 1 to 7 of 7

Thread: [RESOLVED] How to track changes on a richtextbox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    104

    Resolved [RESOLVED] How to track changes on a richtextbox

    Hello Evryone

    I have an Edit form that has two Richtextboxes:
    *
    I would like to keep track of who makes the changes or edits the form, and I have the following code: and is working just fine:
    Dim stamp As String = "Edited by " & LoginForm1.UsernameTextBox.Text & " on " & Date.Now.ToString
    Me.RichTextBox1.AppendText(Environment.NewLine & stamp)
    Me.RichTextBox2.AppendText(Environment.NewLine & stamp)
    *
    The problem that I am having is that I would like to only add the tracking*log to the RichTextBox that I am modifying.
    Right now if I edit RichTextBox1, it will add the tacking log, but is also adding the tracking log to the RichTextBox2, and I have not touched RichTextBox2,
    How can I make it to work to only add the tacking log to the one that I am touching?
    *
    Thanks for your help

  2. #2
    Addicted Member sauronsmatrix's Avatar
    Join Date
    Jun 2008
    Location
    USA
    Posts
    133

    Re: How to track changes on a richtextbox

    How are you tracking the changes anyway? Using one of these?:

    Code:
       Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
    
        End Sub
    If you are using these events separately for each box, it should work appropriately.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    104

    Re: How to track changes on a richtextbox

    Thanks Sauronsmatrix for your quick responce.

    I have the following code under the save event, is it wrong?

    Code:
    Dim stamp As String = "Edited by " & LoginForm1.UsernameTextBox.Text & " on " & Date.Now.ToString
    Me.RichTextBox1.AppendText(Environment.NewLine & stamp)
    Me.RichTextBox2.AppendText(Environment.NewLine & stamp
    Thanks

  4. #4
    Addicted Member sauronsmatrix's Avatar
    Join Date
    Jun 2008
    Location
    USA
    Posts
    133

    Re: How to track changes on a richtextbox

    im stamp As String = "Edited by " & LoginForm1.UsernameTextBox.Text & " on " & Date.Now.ToString
    Me.RichTextBox1.AppendText(Environment.NewLine & stamp)
    Me.RichTextBox2.AppendText(Environment.NewLine & stamp
    Well you told it to stamp it regardless, so thats that. Maybe you want to have booleans for if the user edited the fields using the .TextChanged event, then have something like:

    Code:
    If blnChanged Then Me.RichTextBox2.AppendText(Environment.NewLine & stamp)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    104

    Re: How to track changes on a richtextbox

    Quick question: Do i need to declare the "blnChanged"?

    Thanks,

  6. #6
    Addicted Member sauronsmatrix's Avatar
    Join Date
    Jun 2008
    Location
    USA
    Posts
    133

    Re: [RESOLVED] How to track changes on a richtextbox

    Dim blnChanged As Boolean

    Booleans can either have a value of True or False.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2008
    Posts
    104

    Re: [RESOLVED] How to track changes on a richtextbox

    Thank you so much for your help.
    BK

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