473,435 Members | 1,755 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,435 software developers and data experts.

Textbox text change

Hi everyone
i have a textbox that is added dynamically in form load
i want an event to happen when the text change
how can i do it?
Thx in Adv
Nov 19 '05 #1
4 1925
Hi,

Raise an event in the TextBox_TextChanged event and write appropriate
handlers for that.

regards
Joyjit

"Mariame" <ma************@hotmail.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Hi everyone
i have a textbox that is added dynamically in form load
i want an event to happen when the text change
how can i do it?
Thx in Adv

Nov 19 '05 #2
the dynamic textbox called "we1"
when i write
Private Sub we1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles we1.TextChanged

End Sub

it gives me error "Handles clause requires a WithEvents variable."

Any idea?

"Joyjit Mukherjee" <jo**************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi,

Raise an event in the TextBox_TextChanged event and write appropriate
handlers for that.

regards
Joyjit

"Mariame" <ma************@hotmail.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Hi everyone
i have a textbox that is added dynamically in form load
i want an event to happen when the text change
how can i do it?
Thx in Adv


Nov 19 '05 #3
Hi,

Declare your variable using:

WithEvents we1 as System.Web.UI.WebControls.TextBox

Regards,
Franck Quintana
Active+ Software
http://www.activeplus.com

"Mariame" <ma************@hotmail.com> wrote in message
news:ua**************@tk2msftngp13.phx.gbl...
| the dynamic textbox called "we1"
| when i write
| Private Sub we1_TextChanged(ByVal sender As System.Object, ByVal e As
| System.EventArgs) Handles we1.TextChanged
|
| End Sub
|
| it gives me error "Handles clause requires a WithEvents variable."
|
| Any idea?
|

Nov 19 '05 #4
Hi Mariame,

Are you adding your own handler? Here's some code to show how it is done.
Note that getting the TextChanged event to fire can be tricky... you may
need to hit the Enter key in the texbox after changing the text.

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim txtbx As New TextBox
txtbx.ID = "Mytextbox"
txtbx.Text = "Change this text and hit Enter"
txtbx.EnableViewState = True
PlaceHolder1.Controls.Add(txtbx)
AddHandler txtbx.TextChanged, AddressOf TextBox_TextChanged
End Sub

Private Sub TextBox_TextChanged _
(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim txtbx As TextBox
txtbx = sender
Label1.Text = txtbx.ID & " at " & Now.ToLongTimeString
End Sub

<form id="Form1" method="post" runat="server">
<p>
<asp:placeholder id="PlaceHolder1"
runat="server"></asp:placeholder>
<asp:label id="Label1" runat="server"></asp:label></p>
<p>&nbsp;</p>
</form>

Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto

"Mariame" <ma************@hotmail.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
Hi everyone
i have a textbox that is added dynamically in form load
i want an event to happen when the text change
how can i do it?
Thx in Adv


Nov 19 '05 #5

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

Similar topics

3
by: Ronald S. Cook | last post by:
Hi all, I have an ASP.NET DataGrid wherein there is an edit link for each row. Upon clicking the link, certan fields in that row display in text boxes so that they may be edited. I would like...
13
by: Paul Slavin | last post by:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this?? any answers appreciated, as to due to the underlying...
14
by: Mike L | last post by:
This is for a Winform. What is the code to send text to a text box in another form? In my search form when the user click OK, I want to sent a string to a text box in frmDataEntry. The code I...
4
by: Jurjen de Groot | last post by:
I'm developing a ASP.NET/VB.NET web application. (VS.NET 2003) I've created several webpages, but on two pages one textbox colors yellow (the background) and I can't get the background to appear...
3
by: Justin Morris via DotNetMonster.com | last post by:
<asp:TextBox ID="TextBox1" runat="server" value='<%=Server.HtmlEncode (Request.Cookies("Username")("Username"))%>'/> <input name="Password" type="text" id="Password" value='<%...
3
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
2
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
16
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString...
7
by: sphinney | last post by:
I have a datasheet style form with textbox (MyTextBox) that has the Text Format property set to "Rich Text". It is bound to a memo field in a table. How do I change the text or highlight color of...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.