Aelux Aelux - 1 year ago 79
C# Question

C# Cannot inplicitly convert form to from

So i am trying to store my main form and open a new one however i get this error, here is the code:

I have this at form level

public static frmAddBook frmkeepBooks = null;

public frmMain()
frmkeepBooks = this;

The error underlines "this" saying it "Cannot inplicitly convert type Books.frmMain to Books.frmAddBook"

Answer Source

Change the first line into:

public static frmMain frmkeepBooks = null;

The types should be equal (or in herited) and probably it is not.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download