|
yes i have tried with . instead of ->
|
|
|
|
|
Hi Can you please paste your code snippet.
Regards,
Sandip.
|
|
|
|
|
Addcam c;<br />
c.DoModal();<br />
CEdit m_edit1;<br />
CString csTemp;<br />
m_edit1.GetWindowText(csTemp);<br />
AfxMessageBox(csTemp);
where Addcam is the class of the dialog which is invoked when the button is clicked.
|
|
|
|
|
Your m_edit1 is not associated with any editbox.
if you have your edit box on dialog pointed bye variable c
then you need to have a string variable in calss AddCam say strTemp.
When you press OK on dialog store the string from edit box to strTemp using GetDlgItemText(IDC_EDIT1,strTemp).
then use the strTemp for further processing using c.strTemp.
I hope it makes sense.
one more thing you cant access the control variables after the dialog is destroyed.
Regards,
Sandip.
|
|
|
|
|
Is the m_edit1 is in Addcam dialog?
akt
|
|
|
|
|
yes...its the edit box in Addcam dialog.have three more edit boxes there.
|
|
|
|
|
You cant access the control variables after the dialog is destroyed.
You need to store the values in strings and access them after the DoModal() call.
Regards,
Sandip.
|
|
|
|
|
sorry..this is not working at all..
|
|
|
|
|
what is not working paste your code
Regards,
Sandip.
|
|
|
|
|
Addcam c;<br />
c.DoModal();<br />
CString st;<br />
st=GetDlgItemText(IDC_EDIT1,c.strTemp);<br />
AfxMessageBox(st);
have added strTemp in Addcam class.
Addcam::Addcam(CWnd* pParent )<br />
: CDialog(Addcam::IDD, pParent)<br />
{<br />
CString strTemp;<br />
<br />
}
|
|
|
|
|
CString strTemp;
should be class member of AddCam
projectip wrote: st=GetDlgItemText(IDC_EDIT1,c.strTemp);
should be inside AddCam::OnOK()//
then just write
Addcam c;
c.DoModal();
AfxMessageBox(c.strTemp);
I hope its making sense to you..
Regards,
Sandip.
|
|
|
|
|
That is a very helpfull answer . Why can't you say what is not working ? How can we guess what the problem is ?
If you want an answer, you have to provide some information for us to be able to help you.
|
|
|
|
|
I have given the strTremp in Addcam::OK.But still the messagebox displays nothing.
|
|
|
|
|
Is strTemp member variable of dialog AddCam??
paste the code where you have declared the strTemp.
Regards,
Sandip.
|
|
|
|
|
void Addcam::OnOK() <br />
{<br />
<br />
CDialog::OnOK();<br />
CString strTemp;<br />
}
|
|
|
|
|
Hi Please make it calss member by declaring it in calss definition .h file.
//AddCam.h
class AddCam: public CDialog
{
public:
CString strTemp;
...
}
void Addcam::OnOK()
{
// TODO: Add extra validation here
GetDlgItemText(IDC_EDIT1,strTemp) //IDC_EDIT1 is supposed to be your EDIT box id.
CDialog::OnOK();
}
Are you getting me??
Regards,
Sandip.
|
|
|
|
|
Thank you sooooo much...now it works.....seems like i failed to explain my problem in a clear way..will correct it from next time onwards.
|
|
|
|
|
Hello all,
I want to get character value from an ASCII value. That is, if i pass 65 then I should get 'A' in return. So how could i easily accomplish this??
Please help me out..
Thanks & Regards,
Hemang
|
|
|
|
|
char c = 65;
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
That's crazy... You gave the same answer than me and you got downvoted while I got a 5
|
|
|
|
|
However, don't worry, I don't mind about down voters (and after all, I have a lot of friends).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
char c = 65;
It's as easy as that. Now your c character holds the 'A' letter.
|
|
|
|
|
printf("%c",i); // i could have any integer value
Put in other words you can simply typecast an int to a char to get its ASCII value
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
CString csTemp;
csTemp.Format( "%c", 65 );
Will result "A" in csTemp.
akt
|
|
|
|
|
If you want a function anyway:
char getCharEquivalent(int i)
{
char c = i;
return c;
}
void main()
{
int i = 65;
char cCharEquiv = getCharEquivalent(i);
}
Put a break point inside main and check cCharEquiv, it will be 'A'
ASCII is nothing but numeric value of the character.
--
"Programming is an art that fights back!"
|
|
|
|