Click here to Skip to main content
15,032,967 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to take multiple input from a single texbox ...like in calculator you have to take multiple input from a single textbox and then u have to work on those input..
Posted
Comments
Yuri Vital 6-Jul-11 5:25am
   
And whait is your problem ? What have you tried ?
   
Not clear what you call "multiple input". It looks like you simply need it multi-line.
You also need to tag UI library you use.
--SA

You need to type something, store it in a variable somewhere, clear the text box when the user chooses + or - (say, on the calculartor), and then enter the next value.

You can then do calculations on the variables and display the result in the same box.
   
Ok, it depends on your requirement.
If you are going to try an event to go for multiple entries on the same text box, then you may use a StringBuilder to get your values added incrementally with a delimiter (user defined).

So, then you may do your computation or whatsoever, from stripping off the individual strings from the stringbuilder back again.

Cheers
Balaji
   
Comments
mahaizhar 6-Jul-11 7:04am
   
can u pls elaborate more by code?thanks in advance
i-balaji-mani 6-Jul-11 10:21am
   
yeah, i can provide a code sample. But before that can u explain more on what your requirement is about?
You got to add a KeyPress event on the textbox. Lets say, if user hits "Enter", "+", "-", "=", "Esc", etc keys you pickup the text n store in StringBuilder. Then clear the textbox. This way all string entered will be stored in StringBuilder when the textbox receives a key which is handled in KeyPress event. This cycle goes on untill you hae any key to stop the storing process.

If on "Esc" key the cycle must stop, then process whatever you want with the strings stored in the StringBuilder and you got the results.
   
Comments
mahaizhar 6-Jul-11 7:24am
   
i will try .

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