473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

TextChanged Asp.net question

The code below works fine for one textbox (hit enter key) but adding another
textbox and including the handle for it will not change either textbox
without switching the focus to say a button. Do not understand the concept
why it works for one but not two boxes.
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged

Dim txt As TextBox = CType(sender, TextBox)

txt.Text = txt.Text.ToUpper

End Sub
Nov 21 '05 #1
5 3846
"barry" <fl******@ix.netcom.com> schrieb:
The code below works fine for one textbox (hit enter key) but adding
another
textbox and including the handle for it will not change either textbox
without switching the focus to say a button. Do not understand the concept
why it works for one but not two boxes.
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged

Dim txt As TextBox = CType(sender, TextBox)

txt.Text = txt.Text.ToUpper


Is this the complete code?

Short but complete programs
<URL:http://yoda.arachsys.com/csharp/complete.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
I will state my question again related to the code that follows:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
Dim txt As TextBox = CType(sender, TextBox)

txt.Text = txt.Text.ToUpper

End Sub

When there is a button on the webform along with the above two textboxes the
code above will execute when I hit the enter key in each textbox
Why, When I remove the button on the form and hit the enter key in each
textbox nothng happens?

thanks


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl...
"barry" <fl******@ix.netcom.com> schrieb:
The code below works fine for one textbox (hit enter key) but adding
another
textbox and including the handle for it will not change either textbox
without switching the focus to say a button. Do not understand the concept why it works for one but not two boxes.
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

Dim txt As TextBox = CType(sender, TextBox)

txt.Text = txt.Text.ToUpper


Is this the complete code?

Short but complete programs
<URL:http://yoda.arachsys.com/csharp/complete.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Your button is causing a post back, allowing this server side event to
execute.

Without the button, no postback and hence no server side code will ever
execute.

I suggest posting to microsoft.public.dotnet.framework.aspnet group for more
responses.

Greg

"barry" <fl******@ix.netcom.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
I will state my question again related to the code that follows:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
Dim txt As TextBox = CType(sender, TextBox)

txt.Text = txt.Text.ToUpper

End Sub

When there is a button on the webform along with the above two textboxes
the
code above will execute when I hit the enter key in each textbox
Why, When I remove the button on the form and hit the enter key in each
textbox nothng happens?

thanks


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl...
"barry" <fl******@ix.netcom.com> schrieb:
> The code below works fine for one textbox (hit enter key) but adding
> another
> textbox and including the handle for it will not change either textbox
> without switching the focus to say a button. Do not understand the concept > why it works for one but not two boxes.
> Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles TextBox1.TextChanged
>
> Dim txt As TextBox = CType(sender, TextBox)
>
> txt.Text = txt.Text.ToUpper


Is this the complete code?

Short but complete programs
<URL:http://yoda.arachsys.com/csharp/complete.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #4
Greg/Barry,

Or you have to set the autopostback to true

http://msdn.microsoft.com/library/de...tBackTopic.asp

:-)

Just to be sure we are talking about the same

Cor

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com>
Your button is causing a post back, allowing this server side event to
execute.

Without the button, no postback and hence no server side code will ever
execute.

I suggest posting to microsoft.public.dotnet.framework.aspnet group for
more responses.

Greg

"barry" <fl******@ix.netcom.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
I will state my question again related to the code that follows:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
Dim txt As TextBox = CType(sender, TextBox)

txt.Text = txt.Text.ToUpper

End Sub

When there is a button on the webform along with the above two textboxes
the
code above will execute when I hit the enter key in each textbox
Why, When I remove the button on the form and hit the enter key in each
textbox nothng happens?

thanks


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl...
"barry" <fl******@ix.netcom.com> schrieb:
> The code below works fine for one textbox (hit enter key) but adding
> another
> textbox and including the handle for it will not change either textbox
> without switching the focus to say a button. Do not understand the

concept
> why it works for one but not two boxes.
> Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal
> e

As
> System.EventArgs) Handles TextBox1.TextChanged
>
> Dim txt As TextBox = CType(sender, TextBox)
>
> txt.Text = txt.Text.ToUpper

Is this the complete code?

Short but complete programs
<URL:http://yoda.arachsys.com/csharp/complete.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



Nov 21 '05 #5
Thanks to all - the autopostback did the trick
"Cor Ligthert" <no************@planet.nl> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
Greg/Barry,

Or you have to set the autopostback to true

http://msdn.microsoft.com/library/de...tBackTopic.asp
:-)

Just to be sure we are talking about the same

Cor

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com>
Your button is causing a post back, allowing this server side event to
execute.

Without the button, no postback and hence no server side code will ever
execute.

I suggest posting to microsoft.public.dotnet.framework.aspnet group for
more responses.

Greg

"barry" <fl******@ix.netcom.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
I will state my question again related to the code that follows:

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e
As
System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
Dim txt As TextBox = CType(sender, TextBox)

txt.Text = txt.Text.ToUpper

End Sub

When there is a button on the webform along with the above two textboxes the
code above will execute when I hit the enter key in each textbox
Why, When I remove the button on the form and hit the enter key in each
textbox nothng happens?

thanks


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl...
"barry" <fl******@ix.netcom.com> schrieb:
> The code below works fine for one textbox (hit enter key) but adding
> another
> textbox and including the handle for it will not change either textbox > without switching the focus to say a button. Do not understand the
concept
> why it works for one but not two boxes.
> Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal > e
As
> System.EventArgs) Handles TextBox1.TextChanged
>
> Dim txt As TextBox = CType(sender, TextBox)
>
> txt.Text = txt.Text.ToUpper

Is this the complete code?

Short but complete programs
<URL:http://yoda.arachsys.com/csharp/complete.html>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Fabrício de Novaes Kucinskis | last post by:
Hi all, I have a combobox control, in wich I put an autocomplete code. This code is in the TextChanged event, but when this event fires, the Text property isn't updated yet. For example, if...
4
by: Francesco | last post by:
Hi all, I am trying to make a UserControl with a TextBox in it. I have to publish the TextChanged event of the inner TextBox, but I have some trouble. If I declare : public event EventHandler...
2
by: jorge | last post by:
Hello I have the following situation: (everything is dynamic (controls.add)) 1. Button.Init { WasButtonClickFired = true } 2. TextBox.TextChanged { WasButtonClickFired?
2
by: Owin | last post by:
Hi all, I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster. The control wordks great if autopostback is on. When...
1
by: Samuel Chan | last post by:
I used the textchanged event of textbox and set the autopostback property to true. The textchanged event should fire when the content of the textbox is changed and user tab out of the textbox...
2
by: Fabio Cannizzo | last post by:
Hi. The content of my textbox is "ABCD". If I select the letter 'C' and I press 'X', the content obviously changes to "ABXD". Thsi however generates two separate "TextChanged" events 1) ...
3
by: Robert W. | last post by:
I'm new to ASP.net programming so excuse my ignorance if the following question seems overly simplistic. I've created a simple Login form with 3 primary WebControls: - A TextBox for the Username...
1
by: PromisedOyster | last post by:
1. I have a series of RequiredFieldValidators that need to be be enabled/disabled depending on what the user types into various text boxes. Can I do this using the Enabled property of the...
2
by: Tony | last post by:
Hello! Here I have a simple question. Below I have a method handler for event TextChanged called textBox_TextChanged If event TextChanged is trigged for a TextBox where the name property is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.