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

Get text in TextBox without pressing Enter key

mg
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that I
want to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

Nov 17 '05 #1
10 9104
mg
P.S. I need a C# solution. Thanks.

-----Original Message-----
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that I
want to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

.

Nov 17 '05 #2
mg
P.S. I need a C# solution. Thanks.

-----Original Message-----
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that I
want to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

.

Nov 17 '05 #3
double clicking on the button in the design view that you want to use will
provide you with the event handler you require, alternatively you can just
create a empty method which would look something like this:

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

end sub.
then, say your edit box has the id = "editBoxText". You'll be able to call
the editBoxText.Text() method on that member variable created for that
control and access the text.

is that what you wanted or did i miss the boat?

if you want to set the focus from the submit button back to the edit box,
check out this website for a short method on setting focus...

http://aspnetweblog.com/posts/7115.aspx
"mg" <mg@theworld.com> wrote in message
news:03****************************@phx.gbl...
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that I
want to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

Nov 17 '05 #4
double clicking on the button in the design view that you want to use will
provide you with the event handler you require, alternatively you can just
create a empty method which would look something like this:

Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

end sub.
then, say your edit box has the id = "editBoxText". You'll be able to call
the editBoxText.Text() method on that member variable created for that
control and access the text.

is that what you wanted or did i miss the boat?

if you want to set the focus from the submit button back to the edit box,
check out this website for a short method on setting focus...

http://aspnetweblog.com/posts/7115.aspx
"mg" <mg@theworld.com> wrote in message
news:03****************************@phx.gbl...
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that I
want to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

Nov 17 '05 #5
mg,

Then the code that dj Bass just gave you is what you want.

You get the text with:

MyTextBox.Text

Justin
"mg" <mg@theworld.com> wrote in message
news:08****************************@phx.gbl...
I have an event handler for the button click event. What I
need is [C#] code to place in this event handler. The code
needs to read the characters in the TextBox without my
having [physically] pressed the enter key after entering
the characters in the TextBox or having given another
control focus by pressing on it with the mouse.

-----Original Message-----
double clicking on the button in the design view that you

want to use will
provide you with the event handler you require,

alternatively you can just
create a empty method which would look something like

this:

Private Sub btnSubmit_Click(ByVal sender As

System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

end sub.
then, say your edit box has the id = "editBoxText".

You'll be able to call
the editBoxText.Text() method on that member variable

created for that
control and access the text.

is that what you wanted or did i miss the boat?

if you want to set the focus from the submit button back

to the edit box,
check out this website for a short method on setting

focus...

http://aspnetweblog.com/posts/7115.aspx
"mg" <mg@theworld.com> wrote in message
news:03****************************@phx.gbl...
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that I want to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

.

Nov 17 '05 #6
mg,

Then the code that dj Bass just gave you is what you want.

You get the text with:

MyTextBox.Text

Justin
"mg" <mg@theworld.com> wrote in message
news:08****************************@phx.gbl...
I have an event handler for the button click event. What I
need is [C#] code to place in this event handler. The code
needs to read the characters in the TextBox without my
having [physically] pressed the enter key after entering
the characters in the TextBox or having given another
control focus by pressing on it with the mouse.

-----Original Message-----
double clicking on the button in the design view that you

want to use will
provide you with the event handler you require,

alternatively you can just
create a empty method which would look something like

this:

Private Sub btnSubmit_Click(ByVal sender As

System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

end sub.
then, say your edit box has the id = "editBoxText".

You'll be able to call
the editBoxText.Text() method on that member variable

created for that
control and access the text.

is that what you wanted or did i miss the boat?

if you want to set the focus from the submit button back

to the edit box,
check out this website for a short method on setting

focus...

http://aspnetweblog.com/posts/7115.aspx
"mg" <mg@theworld.com> wrote in message
news:03****************************@phx.gbl...
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that I want to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

.

Nov 17 '05 #7
Unless you expect the event handler for a button to simply pick up the text
from the text box as you write? which wouldn't work, you'd need an event
handler for the text box on the text change event...

as they say in Zulu, angaas.

"S. Justin Gengo" <ge****@krause.com> wrote in message
news:vh************@corp.supernews.com...
mg,

Then the code that dj Bass just gave you is what you want.

You get the text with:

MyTextBox.Text

Justin
"mg" <mg@theworld.com> wrote in message
news:08****************************@phx.gbl...
I have an event handler for the button click event. What I
need is [C#] code to place in this event handler. The code
needs to read the characters in the TextBox without my
having [physically] pressed the enter key after entering
the characters in the TextBox or having given another
control focus by pressing on it with the mouse.

-----Original Message-----
double clicking on the button in the design view that you

want to use will
provide you with the event handler you require,

alternatively you can just
create a empty method which would look something like

this:

Private Sub btnSubmit_Click(ByVal sender As

System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

end sub.
then, say your edit box has the id = "editBoxText".

You'll be able to call
the editBoxText.Text() method on that member variable

created for that
control and access the text.

is that what you wanted or did i miss the boat?

if you want to set the focus from the submit button back

to the edit box,
check out this website for a short method on setting

focus...

http://aspnetweblog.com/posts/7115.aspx
"mg" <mg@theworld.com> wrote in message
news:03****************************@phx.gbl...
> I want to enter characters in a TextBox in a WebForm,
> press a Button in the WebForm, and read the characters
> that were typed into the TextBox from within the
> Button_Click event handler. The main point here is that

I
> want to read the value typed into the TextBox without
> hitting the Enter key or setting focus on another
> control ...
.


Nov 17 '05 #8
Unless you expect the event handler for a button to simply pick up the text
from the text box as you write? which wouldn't work, you'd need an event
handler for the text box on the text change event...

as they say in Zulu, angaas.

"S. Justin Gengo" <ge****@krause.com> wrote in message
news:vh************@corp.supernews.com...
mg,

Then the code that dj Bass just gave you is what you want.

You get the text with:

MyTextBox.Text

Justin
"mg" <mg@theworld.com> wrote in message
news:08****************************@phx.gbl...
I have an event handler for the button click event. What I
need is [C#] code to place in this event handler. The code
needs to read the characters in the TextBox without my
having [physically] pressed the enter key after entering
the characters in the TextBox or having given another
control focus by pressing on it with the mouse.

-----Original Message-----
double clicking on the button in the design view that you

want to use will
provide you with the event handler you require,

alternatively you can just
create a empty method which would look something like

this:

Private Sub btnSubmit_Click(ByVal sender As

System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click

end sub.
then, say your edit box has the id = "editBoxText".

You'll be able to call
the editBoxText.Text() method on that member variable

created for that
control and access the text.

is that what you wanted or did i miss the boat?

if you want to set the focus from the submit button back

to the edit box,
check out this website for a short method on setting

focus...

http://aspnetweblog.com/posts/7115.aspx
"mg" <mg@theworld.com> wrote in message
news:03****************************@phx.gbl...
> I want to enter characters in a TextBox in a WebForm,
> press a Button in the WebForm, and read the characters
> that were typed into the TextBox from within the
> Button_Click event handler. The main point here is that

I
> want to read the value typed into the TextBox without
> hitting the Enter key or setting focus on another
> control ...
.


Nov 17 '05 #9
Hi,

It is not clear what you actually want to do.

You have said that after entering text in the textbox, you
will be pressing a Button in the web form. When you press
the button obviously, the textbox control will lose focus
and the Button will get focus.

As far as getting the text of the textbox is concerned, it
can be done very easily by writing the event handler for
Button's Click event as follows:

private void Button1_Click(object sender,
System.EventArgs e)
{
string Value;
Value = TextBox1.Text;
}

Value will contain the text entered in the textbox.

Regards,
Vikram
-----Original Message-----
P.S. I need a C# solution. Thanks.

-----Original Message-----
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that Iwant to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

.

.

Nov 17 '05 #10
Hi,

It is not clear what you actually want to do.

You have said that after entering text in the textbox, you
will be pressing a Button in the web form. When you press
the button obviously, the textbox control will lose focus
and the Button will get focus.

As far as getting the text of the textbox is concerned, it
can be done very easily by writing the event handler for
Button's Click event as follows:

private void Button1_Click(object sender,
System.EventArgs e)
{
string Value;
Value = TextBox1.Text;
}

Value will contain the text entered in the textbox.

Regards,
Vikram
-----Original Message-----
P.S. I need a C# solution. Thanks.

-----Original Message-----
I want to enter characters in a TextBox in a WebForm,
press a Button in the WebForm, and read the characters
that were typed into the TextBox from within the
Button_Click event handler. The main point here is that Iwant to read the value typed into the TextBox without
hitting the Enter key or setting focus on another
control ...

.

.

Nov 17 '05 #11

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

Similar topics

7
by: Amanda | last post by:
Help, I am new to visual basic programming and I was wondering how to allow a textbox to do a calculation by pressing enter ie I want to type the following into a textbox 25.2 * 2 press...
20
by: Dannyboyo | last post by:
I have what I hope is a simple request. I can't really code in javascript, but I am pretty good at cusomizing it with slight modifications. I code in ASP and HTML. I am trying to capture customer...
3
by: Jose Egea | last post by:
Hello: I'm trying to execute a function when the user press Enter key in a TextBox. But something is happening in my form because after pressing a button, when I press the Enter key in the...
0
by: mg | last post by:
I want to enter characters in a TextBox in a WebForm, press a Button in the WebForm, and read the characters that were typed into the TextBox from within the Button_Click event handler. The main...
4
by: Jerry | last post by:
Hello I have some textboxes (input type=Text) in a Form. In some Forms if I Press Enter while I am in the Textbox It causes a Submit. The input type is text not submit. It's obsure that the...
2
by: Fernando Lopes | last post by:
Hi. I one usercontrol, i have a zipcode textbox . I need to, when user press ENTER, I call a code-behind method, to check this zipcode on database and, depending the return of this check,...
4
by: peshrad | last post by:
Hi ! I'm working with Win 2K and Visual Studio 2003. I have a problem because pressing <ENTER> in a text input control causes a postback of my web form. Here comes some example code (already...
2
by: jd | last post by:
I have several textboxes in which the end user can enter values. When the user presses the Enter key when in any of the textboxes, or leaves that textbox, I want a routine to run (mathematical...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.