Re: How to convert CString object to data type?
These are the DDX_Text method available in 6.0 and float is available.
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, BYTE& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, short& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, int& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, UINT& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, long& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, DWORD& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, CString& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, float& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, double& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, COleCurrency& value );
void AFXAPI DDX_Text( CDataExchange* pDX, int nIDC, COleDateTime& value );
AliR.
"Y Xu" <y.xu@qub.ac.uk> wrote in message
news:uLS1J05iGHA.4660@TK2MSFTNGP03.phx.gbl...
My Version is 6.0, maybe that's the reason lacking the features you have.
"r norman" <NotMyRealEmail@_comcast.net> wrote in message
news:c1dh82t1j4j32loksl8895om8j5uc0kjg4@4ax.com...
On Thu, 8 Jun 2006 23:57:19 +0100, "Yuchun Xu"
<breezexuyc@ntlworld.com> wrote:
"r norman" <NotMyRealEmail@_comcast.net> wrote in message
news:vseg821vs71ptbpm6jb5i2qj52fr1rt8v9@4ax.com...
On 8 Jun 2006 07:31:57 -0700, kiran.inbng@gmail.com wrote:
Hi Y Xu,
Can you be more specific , what type do you want it to be converted to
?
/Kiran
Y Xu wrote:
How can I convert CString from a EDIT control Dialog to data type
for
Why not just let the Add Variable wizard create a variable of the
appropriate data type for your control? It includes a very wide range
of options that almost certainly will handle whatever it is you want
to do.
In my MFC based Dialog, an Edit control is used to get user input (int
or
float type). In Class wizard, I only could associate a CString value
varialbe with the Edit control, there was no any other type to choose.
So
I
need to convert the input of CString to either int or float type. How
can
I
implement it?
I don't know what version of MFC and VC++ you are using. Mine (Visual
Studio 2005 or VC++ 8) has DDX_Text() capable of interpreting the
value in the edit box as a float. Check the help for your own
version. It might well be the same in which case all you have to do
is declare the variable to be type float and it will be done for you.