开发者

Data between forms & inaccesible duo to its protection level

Im trying to make a quite simple game but its having an error.

I have three forms. bounce, ball and Option in the option form I have 3 radiobuttons . Easy, medium and hard.

But when im trying to get my If to work in bounce. I get an error under easyradio that says 'bounce.options.easyradio' is inaccessible due its protection level

 options tf = new 开发者_JAVA百科options();
    public void optionbtn_Click(object sender, EventArgs e)
    {
        tf.ShowDialog(this);
        if (
            tf.easyradio.Checked)
        {
            Random randwind = new Random();
            Ball.w = -5 + randwind.Next(5);
        }

The code in my option form for button easy is looking like this

  public void easy_CheckedChanged(object sender, EventArgs e)
    {

    }

I really don't know how to solve this problem -

thanks


Change your easyradio modifier to public. You can do this from Form designer.


I'm assuming the optionBtn_Click is in the options class.

In that case ditch the "tf." in front of everything, you're already in the class scope, and you're trying to use an instance of a class from it's definition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜