本文介绍了从textBox获取文本并将其用作dword值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我的项目是Windows窗体应用程序(使用Microsoft Visual C ++ Studio 2010).
我创建了一个textBox.该文本框下面有3个单选按钮(分别名为Hex,Dec,Bin).我需要的是在用户选择通过单击单选按钮给出的选项之一之后,他输入一些数字(假设他选择Bin并输入11100).然后,他单击Dec,文本框中的数字将更改为28(十进制值11100).如果他单击十六进制",则数字将更改为1C(11100的十六进制).

现在是要点:假设用户选择十六进制并输入1C.在将文本作为字符串检索之后,我必须声明一个DWORD类型的变量,例如DWORD d;保留文本的十六进制值.我该怎么办,因为我不知道用户要输入什么号码.如果我知道他要输入1C,则可以这样声明DWORD d = 0x1C.

请帮助我!

任何帮助将不胜感激!

Hello everybody!

My project is windows form application (using Microsoft Visual C++ Studio 2010).
I''ve created a textBox. There are 3 radio buttons below that textBox (named Hex, Dec, Bin). What I need is after the user chooses one of the option given by clicking on a radio button, he enters some number (let''s say he chooses Bin and enters 11100). Then he clicks on Dec the number in textBox will be changed to 28 (the decimal value of 11100). If he clicks on Hex then the number will be changed to 1C (the hexcimal of 11100).

Now is the point: let''s assume that the user chooses Hex and enters 1C. After I retrieve that text as a string, I have to declare a variable of type DWORD like DWORD d; that holds the hexcimal value of the text. How could I do that because I don''t know what number the user is going to enter. If I knew that he is going to enter 1C, then I could declare like this DWORD d = 0x1C.

Please help me with this!

Any help would be appreciated!

Thank in advance!

推荐答案



这篇关于从textBox获取文本并将其用作dword值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 19:11