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

turning a textbox into a calculator

Hi,
I'm trying to figure out how to take the string entered into a textbox, and
if I don't just accept the number entered, if +, -, *, / were entered, to
convert that into the correct number to be displayed in the textbox. I'm not
completely sure how to go about this.
Thanks!
Melanie
Nov 17 '05 #1
1 1319
melanieab wrote:
Hi,
I'm trying to figure out how to take the string entered into a textbox, and
if I don't just accept the number entered, if +, -, *, / were entered, to
convert that into the correct number to be displayed in the textbox. I'm not
completely sure how to go about this.
Thanks!
Melanie


You can add a handler for textBox.KeyDown and analyze what key was pressed.
Then just set e.Handled = true to prevent bubbling.

BR,
Andrey
Nov 17 '05 #2

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

Similar topics

20
by: Brian Kazian | last post by:
Here's my problem, and hopefully someone can help me figure out if there is a good way to do this. I am writing a program that allows the user to enter an equation in a text field using...
7
by: scottiedog | last post by:
Hi How can I send a char to Textbox so that KeyPress event is called? I have a button and with a click I would like to send a char, e.g. "C", to the Textbox. But Textbox1_KeyPress is not catching...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
19
by: TexasNewbie | last post by:
This was originally just a calculator without a decimal point. After I added the decimal, it now tells me invalid second number. //GUI Calculator Program import javax.swing.*; import...
3
Wagsy
by: Wagsy | last post by:
Hi All, I have a virtual keypad - say 0-9, when i press the buttons i want the sequence of keypresses to appear in a textbox. at the moment when i type them in they just overwrite each other. i want...
1
by: gdavid | last post by:
Hi. I Have started using Visual C++ 2008 a month ago. I Tried to make a GUI calculator but i cannot convert the textbox's text with the atof() function. The function cannot convert String^ type into...
6
by: AhmedGY | last post by:
Hi, I'm new to C#, and doing a simple calculator application, it's completed now and calculates well, i wanna provide the interface with hotkeys so when the user press a number lets say "1" on the...
3
by: mandy335 | last post by:
public class Calculator { private long input = 0; // current input private long result = 0; // last input/result private String lastOperator = ""; // keeps track of...
1
by: =?Utf-8?B?eXVyaWtz?= | last post by:
Hey, I'm building a business application that needs input of currency data. I looked a lot around google and friends for a good custom control to provide interactive validation and formatting of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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
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...

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.