I have two textboxes...on the textchanged event of one textbox, readonly property of other textbox gets defined...e.g. first textbox is retrieving data as add,update,delete...when the first textbox text is changed to update then & then only second textbox readonly property is set to false...Now the problem,I am facing is....whenevr first textbox text is add,delete,its working fine..& second textbox is fetching the correct data..but once first textbox data gets changed to update,second textbox data remain unchanged though its readonly property gets changed correctly..it shows the same data as it was showing the first time when first textbox was changed to update...but after that,its data is not changing...plz help..

Seems that you are not storing/saving the updated text. Either save it or store it in a String.
2 TextBoxes (use TextBox1 to type in commands)

Public Class Form1
    Private sUpdateOfTxt2 As String = "updating content" '// stores updated text of TextBox2.

    Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
        With TextBox2
            If .ReadOnly = False Then .ReadOnly = True '// set to True if False.
            Select Case TextBox1.Text.ToLower
                Case "add" : .Text = "adding content"
                Case "delete" : .Text = "deleting content"
                Case "update" : .ReadOnly = False : .Text = sUpdateOfTxt2
                Case Else : .Text = "standby mode"
            End Select
        End With
    End Sub

    Private Sub TextBox2_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox2.TextChanged
        With TextBox2
            If .ReadOnly = False Then sUpdateOfTxt2 = .Text '// set text to String for storing.
        End With
    End Sub
End Class

Edited 5 Years Ago by codeorder: n/a

I don't really get what you meant, will be better if you can post the code like what prnvnkmr194 said. But I would suggest that you either haven't changed the "readonly" property of the 2nd textbox or haven't saved last progress. There is a chance that you got logical error as well.

I had similar problems trying to change the text on a button...
saveButton.Text = "Save"

I ended up adding the line...
saveButton.Refresh()

and my problem is resolved.

This article has been dead for over six months. Start a new discussion instead.