开发者

c# identifier not found

using System;

namespace it2b_project_01
{
    static class class1
    {
        static public class1()
        {
            InitializeComponent();
        }


        public static void error_check(object sender, EventArgs e)
        {
        }
    }
}

(different .cs file)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace it2b_project_01
{
    public partial class Create_an_Order : Form
    {
        public Create_an_Order()
        {
            InitializeComponent();
        }

        private void Create_an_Order_Load(object sender, EventArgs e)
        {

        }

        private void Order_Button_Submit_Click(object sender, EventArgs e)
        {
            class1.error_check();
     开发者_开发百科   }
    }
}

Create an Order.cs(26,13): error CS0103: The name 'class1' does not exist in the current context.


make

static class class1

public static class class1

it cannot find it because it is not public


  1. Access modifiers like public are not allowed on static constructors so drop the public from the class1 constructor.

  2. error check takes 2 paramters which your not passing in.

I did those two things and it complied.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜