2 years ago

#35277

test-img

Ibery Wong

How can I put control on another partial C# class?

I created a form with one button for testing. If the button is pressed, a message box will pop up and display Hello.

Then I add another class and moved the button click to this partial class, when I double click the button in the Designer form, it won't jump to the the partial class.

Anyone please help? Below are part of my code:

Form1.cs

//------------------------------------------------------------------------------------
namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    }
}
//------------------------------------------------------------------------------------

Class1.cs

//------------------------------------------------------------------------------------
namespace WindowsFormsApp1
{
    public partial class Form1 
    {
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Hello");
        }
    }
}
//------------------------------------------------------------------------------------

c#

partial

0 Answers

Your Answer

Accepted video resources