简单的键盘 [英] Simple Keypad
问题描述
再一次,我仍然很新,但是在视觉工作室2008中使用c sharp在线教程学习了很多。我正在尝试构建一个计算器,但我不需要数学帮助可能会想。我期待着把自己搞清楚的挑战。
我需要帮助的对你们来说似乎很容易。我有一个文本框用作显示器和键盘,所有数字都是0-9。我想让键与显示器交互。如果我点击2然后0然后6我希望显示器显示206。
我确定这很容易,但出于某种原因,它正在逃避我。我该怎么做呢?是否有人可以向我展示一些示例代码? :)
谢谢!
Craig
Once again, I''m still very new but learning a ton through online tutorials using c sharp in visual studio 2008. I''m trying to build a calculator but I don''t need help with the math as you might think. I''m looking forward to the challenge of figuring that out myself.
What I need help with will probably seem easy to you guys. I have a text box being used as a display and a keypad with all number 0-9 on them. I want to make the keys interactive with the display. If I hit "2" then "0" then "6" I want the display to show "206".
I''m sure it''s totally easy but for some reason it''s escaping me. How do I do this? Is there some sample code that someone can show me to learn from? :)
Thanks!
Craig
推荐答案
文本框的属性为.Text
它包含(作为字符串)文本框中的文本。
您可以获取并设置此文本。
A textbox has a property of .Text
It contains (as a string) the text that is in the textbox.
You can get and set this text.
你摇滚!我不知道我是怎么错过的。我尝试了一切,除了:
myDisplayTextbox.Text = myDisplayTextbox.Text +" 5" ;;
-Craig
PS - 这个网站很棒!
You rock! I don''t know how I missed that. I tried EVERYTHING except:
myDisplayTextbox.Text = myDisplayTextbox.Text + "5";
-Craig
PS - This site is amazing!
PS - 如果有的话快速简便的方法来编程键在多个文本框上工作然后我很乐意看到它。销售点系统将是一个很好的示例,您可以使用一个键盘在多个文本框中输入数字。我有一种感觉,这是一些设置,可以告诉程序运行时当前活动的文本框,然后在那里输入文本。
我还没有做过任何研究,所以不用担心。 :)
再次感谢,
Craig
PS - If there is a quick and easy way of programming the keys to work on multiple text boxes then I''d love to see it. A Point of Sale system would be a good example where you would use ONE keypad to enter numbers in multiple text boxes. I have a feeling it''s some setting that can tell what text box is currently active with the program running and then enters text there.
I haven''t done any research on it yet so no worries if not. :)
Thanks again,
Craig
这篇关于简单的键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!