Hides my code's inherited member warning! - I don't know where it came from

I am new to C #, I have a method that gets called when the BUTTON button or key is pressed. Everything goes smoothly at first, and when I almost finished my project, I cleaned up the code a bit (I removed some comments and removed unnecessary codes). But after that a warning message appears and the keyboard shortcut does not function as it did before, warning message:

Warning 1 'Inventory_program.IPForm.Update ()' hides the inherited element 'System.Windows.Forms.Control.Update ()'. Use a new keyword if hiding was intended.

Here's my code:

    private void Update()
    {
     if (getset.clik2 == 1)
       {
         MessageBox.Show("No data to update, dumbass!!", "!!");
       }
     else
       {
         query = @"select ip_address, pc_name, mac_address, users_owner, locations, remarks
                 from it_ip_inventory ";
         dataGridView1.DataSource = exec.InitConn(query);

       }            
    }

      

Sorry I don't have enough popular point to load the image.

Please help, I don't know how to solve this. I am using WinForms.

+3


source to share


1 answer


The method is Update()

defined for the base management class.

Take a look here: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.update.aspx

In code, you can call things the same as existing (inherited) methods if they have different arguments (overloading). In your case, yours Update()

has identical signature as inline method.



I suggest you take the opportunity to rename the method to something more descriptive like

private void UpdateFromDatabase()
{
}

      

+4


source







All Articles