If I recall correctly, VB.NET (like C#) assumes the expression should be of cbo.SelectedValue
’s type. Try casting it to a Nullable
:
M1(txtSearch.text,
If(cbo.SelectedIndex = 0, Nothing, New Integer?(cbo.SelectedValue))
(… that works, right? Sorry. It’s been a while.) And make sure to have Option Strict On
.