[Solved] cannot implicitly convert type int


The method you are calling expects a nullable int, whereas you are passing the Text property of a textbox, which is a string. Even if the textbox contains as string that can be converted to an int, it’s still a string.

Some languages (such as JavaScript) will automatically convert values for you. C# is strongly typed, and requires you to do the conversion yourself.

You should also validate the contents of the textbox, as if the user didn’t type something that could be converted to an integer, any attempt to convert will fail.

Look at the Convert.ToInt32() and Int32.TryParse() methods

solved cannot implicitly convert type int