title: c# get the value of button clicked from user control
body: <p>I have User Control and named it to <code>ucMilkshake</code> and my main form <code>Form1</code> each of them has a set of buttons. I put the items button on <code>ucMilkshake</code> and Quantity(1,2,3,4,5,6,7,8,9) buttons on <code>Form1</code> the user needs to click <code>btnMilkshake</code> first and <code>ucMilkshake</code> will pop up in a <code>panel</code> inside <code>Form1</code> and there they will see the list of items after they pick 1 of the items they need to choose the quantity of the Item then it will display to <code>listview</code> in <code>Form1</code></p>
  
  <p>but I can't get value of button clicked in User Control hoping someone here can help in my problem using <code>if statement</code> since I have a set of buttons</p>
  
  <p>heres my code:</p>
  
  <p>User Control</p>
  
  <pre><code>public partial class ucMilkshake : UserControl
  {
      int clickcount = 0;
      private static ucMilkshake _instance;
  
      public static ucMilkshake Instance
      {
          get
          {
              if (_instance == null)
                  _instance = new ucMilkshake();
              return _instance;
          }
      }
  
      public ucMilkshake()
      {
          InitializeComponent();
      }
  
      public string MS1
      {
          get
          {
              return button11.Text;
          }
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
          clickcount - 1;
      }
  
     private void button2_Click(object sender, EventArgs e)
      {
          clickcount = 2;
      }
  }`
  </code></pre>
  
  <p>Form1</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
  
      private void Form1_Load(object sender, EventArgs e)
      {
  
      }
  
      private void btnMilkshake_Click(object sender, EventArgs e)
      {
          if (!mainPanel.Controls.Contains(ucMilkshake.Instance))
          {
              mainPanel.Controls.Add(ucMilkshake.Instance);
              ucMilkshake.Instance.Dock = DockStyle.Fill;
              ucMilkshake.Instance.BringToFront();
          }
          else
              ucMilkshake.Instance.BringToFront();
      }
  
      private void quantityOne_Click(Object sender, EventArgs e)
      {
          //here i want to use if statement to get the value of clicked button in user control
  
      private void quantityTwo_Click(Object sender, EventArgs e)
    }
  </code></pre>