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)
{
//...
}

?

You should post more code, your event is not defined as it is in VB

Beware that C# is case sensitive, VB is not.

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.

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
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.