Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can i read a change in the Textbox?

it sets the same value when the page load if I press the button, and not the value that is changed in the text box.

VB
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

Dim txtvalue As string = "string inside textbox"

Textbox1.Text = txtstring
end sub

Protected sub BTEdit_Click(sender As Object, e As EventArgs) Handles BTEdit.Click

Dim Editetvalue as String
Editetvalue = Textbox1.Text

end sub
Posted
Updated 25-Jul-14 6:40am
v2
Comments
Sergey Alexandrovich Kryukov 25-Jul-14 12:34pm    
What is "VB" here, exactly? Application type? (ASP.NET? something else?)
—SA
prototypen 25-Jul-14 12:39pm    
VB, ASP.NET (ASPX website)

1 solution

You can use the IsPostBack property of the actual page.
VB
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    If Page.IsPostBack Then
        Dim txtvalue As string = "string inside textbox"
 
        Textbox1.Text = txtstring
    end if
end sub


Happy coding.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900