Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Error C2248 Help!!! (http://www.go4expert.com/forums/error-c2248-help-t16119/)

liverbird 9Feb2009 04:20

Error C2248 Help!!!
 
Hi,

I have 7 forms in my project. Form 6 has a text box, I wish for the text entered in Form 6 to be passed to a label in Form 7. I am new to C++ and would really appreciate any advice. I have posted the code I am trying to work with but i keep getting error C2248. Please Help!! Thanks.
Code:

public ref class Form6 : public System::Windows::Forms::Form
{
public:String^str1;

public:

Form6(void)


{

InitializeComponent();
//
//TODO: Add the constructor code here
//
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

Application::Exit();
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {

Application::Exit();
}
private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {

this->textBox2->Text = this->textBox1->Text;
this->textBox1->Text = "";
this->textBox1->Text = "Saved";
}
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
public: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
str1 = this->textBox2->text;
Form6::Hide();
Form7 myForm;
if(myForm.ShowDialog() == System::Windows::Forms::DialogResult::OK)

{
//Do stuff
}
}
private: System::Void Form6_Load(System::Object^ sender, System::EventArgs^ e) {
str1 = "str1default";
}
private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
str1=textBox2->Text;
}
};
}


xpi0t0s 9Feb2009 13:59

Re: Error C2248 Help!!!
 
Compiler Error C2248

Error Message
'member' : cannot access 'access' member declared in class 'class'


Which line throws the error?

liverbird 9Feb2009 15:39

Re: Error C2248 Help!!!
 
Hi,

Thanks very much for replying. As you can see I am new to this!! I really appreciate your feedback. I have copied the line (Line 281) which throws the error below:

public: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
this->textBox2->text=str1;//this line throws the C2248 error
Form6::Hide();
Form7 myForm;
if(myForm.ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
//Do stuff
}

asadullah.ansari 9Feb2009 15:50

Re: Error C2248 Help!!!
 
My windows system is hanged.... I cannt test..

liverbird 9Feb2009 16:01

Re: Error C2248 Help!!!
 
Hi,

I have changed "public" to "private" which has solved the C2248 error Thanks.
My problem now is when debugging I click to load Form7 which should have the text from Form6 but there is nothing there not even the textbox?? If you can offer me any advice that would be great.

Thanks


All times are GMT +5.5. The time now is 13:10.