Where do I ask a question on Visual C++ Forms programming? RRS feed

  • Question

  • I can't tell where I should post this question. I'm trying to take a filename opened with a buttonclick and pass that filename back to the main .cpp file using visual studio 2008. Here's snippets of code to help you understand what I mean. First I'll show where I declare the item as a public variable.




    public ref class Form1 : public System::Windows::Forms::Form
    System::String^ filename;

    Then here's the buttonclick event.



    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
    if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
    filename = (openFileDialog1->FileName);
    pictureBox1->Image = Bitmap::FromFile(openFileDialog1->FileName);

    Finally what I need to do in the main CPP file is to get the filename in order to read from that file to a memory object.

    BMP pic;
    pic.ReadFromFile(need filename from form1.h here);

    Please let me know where to post this or the answer of how to do it if you know :)


    Monday, May 4, 2009 11:25 PM