Stoitcho
Thu Apr 26 08:22:49 CDT 2007
Allen,
Excuse me if I don't understand you problem correctly, but I thought the
problem was here
>> dialog2->label1->Text =
>> box->Phone;//<-----error C2039: 'label1' : is not a
>>
>> //member of 'CpForm::MyDialog'
>>
>> dialog2->ShowDialog();
and the error clearly state that you are trying to access the lable (label1)
declared in the MyDialog class and I blieve the label1 member is declared
privately.
Is this the actual problem?
--
Stoitcho Goutsev (100)
"Allen Maki" <allenmaki@sbcglobal.net> wrote in message
news:_YSXh.670$tp5.196@newssvr23.news.prodigy.net...
>
> Hi Stoitcho,
>
> I have the property all ready:
>
> __property void set_Phone(String* p) {phoneBox->Text = p;}
>
> __property String* get_Phone() {return phoneBox->Text;}
>
> As I said before, this code worked very well with a message box, but I
> Wanted it to work with a form and label.
>
> Thanks anyway.
>
> "Stoitcho Goutsev (100)" <100@100.com> wrote in message
> news:ubqxGqzhHHA.208@TK2MSFTNGP05.phx.gbl...
>> Allen,
>>
>> When you drop a control on the form such as label generated member
>> (field) for this control by default is private, so you cannot access it
>> from outside the class. You should provide a public property for get/set
>> the label text (preferable) or change the Modifiers property for the
>> control in the property browser to some less restrictive value such as
>> public or internal (this option I wouldn't recommend.
>>
>> HTH
>>
>> --
>> Stoitcho Goutsev (100)
>>
>> "Allen Maki" <allenmaki@sbcglobal.net> wrote in message
>> news:9KzXh.4548$rO7.269@newssvr25.news.prodigy.net...
>>> Hi Bryant,
>>>
>>>
>>>
>>> I really appreciate you taking the time to help.
>>>
>>>
>>>
>>> I did what you told me and I got the error message below:
>>>
>>>
>>>
>>> private: System::Void dialogBtnItem_Click(System::Object * sender,
>>> System::EventArgs * e)
>>>
>>> {
>>>
>>> MyDialog *box =new MyDialog();
>>>
>>> box->Phone = S"650 123 3456";
>>>
>>>
>>>
>>> if (box->ShowDialog() == DialogResult::OK)
>>>
>>> {
>>>
>>> MyDialog* dialog2 = new MyDialog;
>>>
>>> dialog2->label1->Text =
>>> box->Phone;//<-----error C2039: 'label1' : is not a
>>>
>>> //member of 'CpForm::MyDialog'
>>>
>>> dialog2->ShowDialog();
>>>
>>>
>>>
>>> }
>>>
>>>
>>>
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> "Bryan Phillips" <bphillips@nospam.spamcop.net.spammenot> wrote in
>>> message news:uoxFkJehHHA.4676@TK2MSFTNGP02.phx.gbl...
>>>> Is this what you are looking for?
>>>>
>>>> if (box->ShowDialog() == DialogResult::OK)
>>>> {
>>>> MyDialog* dialog2 = new MyDialog();
>>>> dialog2->label1->Text = box->Phone;
>>>> dialog2->ShowDialog();
>>>> }
>>>>
>>>> --
>>>> Bryan Phillips
>>>> MCSD, MCDBA, MCSE
>>>> Blog:
http://bphillips76.spaces.live.com
>>>> Web Site:
http://www.composablesystems.net
>>>>
>>>>
>>>>
>>>> "Allen Maki" <allen_maki_spam@yahooremove_spam.com> wrote in message
>>>> news:rIUWh.834$im2.778@newssvr22.news.prodigy.net:
>>>>
>>>>> I wonder if you could help.
>>>>>
>>>>> The event handler code below, will allow the user to change the phone
>>>>> number
>>>>> and write it on a label of a message box. I want to replace the
>>>>> message box
>>>>> with a dialog box.
>>>>>
>>>>> Can anybody help me replace the message box below to a dialog box. In
>>>>> other
>>>>> words. I want to write the new phone number on a label (named
>>>>> "labe1")of a
>>>>> dialog box (named "dialog2),instead of writing the new phone number on
>>>>> the
>>>>> label of a message box.
>>>>>
>>>>> private: System::Void dialogBtnItem_Click(System::Object * sender,
>>>>> System::EventArgs * e)
>>>>>
>>>>> {
>>>>>
>>>>> // Create the dialog
>>>>>
>>>>> MyDialog* box = new MyDialog();
>>>>>
>>>>>
>>>>> //Fill in the initial data
>>>>>
>>>>> box->Phone = S"(650)123-3456)"; // <------ This is the phone number to
>>>>> be
>>>>> changed
>>>>>
>>>>> //Show dialog
>>>>>
>>>>> if (box->ShowDialog() == DialogResult::OK)
>>>>>
>>>>> {
>>>>>
>>>>> MessageBox::Show(box->Phone); //<-----I tried to change this line
>>>>>
>>>>>
>>>>> }
>>>>>
>>>>> }
>>>>
>>>
>>>
>>
>>
>
>