Hello every one . I have a piece code in VB.net which work perfectly. but now i convert that code to C# Which give me the follwing error.
"No suitable Method found to override"
my VB.Net Code is Here

  Protected Overrides Sub onload(ByVal e As EventArgs)
        startPosX = Screen.PrimaryScreen.WorkingArea.Width - 330
        startPosY = Screen.PrimaryScreen.WorkingArea.Height
        SetDesktopLocation(startPosX, startPosY)
        MyBase.OnLoad(e)
        Timer1.Start()
    End Sub

and here is converted code

protected override void onload(EventArgs e)
{
    startPosX = Screen.PrimaryScreen.WorkingArea.Width - 330;
    startPosY = Screen.PrimaryScreen.WorkingArea.Height;
    SetDesktopLocation(startPosX, startPosY);
    base.OnLoad(e);
    Timer1.Start();
}

The onload give the error.

Does the parent class have a method

protected virtual void onload(EventArgs e)
{
//...
}

?

It is probably a case-sensitive issue as ddanbe said. Try changing:

protected override void onload(EventArgs e)

To:

protected override void OnLoad(EventArgs e)

The "O" and the "L" should be capitalized.

Edited 2 Years Ago by cgeier

You should be able to override the OnLoad and call the base class's OnLoad first, then your class, for example:

protected override void OnLoad(EventArgs e)
{       
    base.OnLoad(e);

    // Do some stuff here
}
This article has been dead for over six months. Start a new discussion instead.