Sending data to a second dialog??

Hallo!

I have a Main-Window. From there I call a new modal Dialog, to whom I want to pass some data, see below:

private void btn_Prj_anlegen_Click(object sender, EventArgs e)
{
myProjekt.setDataFromLV(x81_LV);
ProjektAnlegenForm prjForm = new ProjektAnlegenForm( myProjekt );
prjForm.ShowDialog();
}

But I get the following error:
Inconsistent accessibility: parameter type 'Projekt' is less accessible than method 'ProjektAnlegenForm(Projekt)'

The myProjekt-Attribute is private, the overloaded ProjektAnlegenForm-contructor is public.

I don't understand, what's the problem here.



Answer this question

Sending data to a second dialog??

  • erb54238

    I passed the class myProjekt to the dialog:

    public ProjektAnlegenForm(Projekt myProjekt)
    {
    InitializeComponent();
    txt_PrjName.Text = myProjekt.Prj_Name;
    txt_PrjBauherr.Text = myProjekt.Prj_Bauherr;
    }

    Now, I want the changed data in my main-Form. I read somewhere, that the myProjekt is passed by reference. But how can I set the changed attributes for the class

    In the method onOK() he doesn't know the myProjekt instance.

    So, how can I pass the data to the Main-Form

  • Bhags

    As the error says, private is less accessible than public :-) Basically, you need to make Projekt class public. I've had this and I've managed to make sense of it, but I can't recall why it made sense at the time :P



  • WestAustinite

    Ah, ok! I thought declaring the class without "public"-keyword makes it automatically public.

  • Sending data to a second dialog??