when comboxbox selects "NOINV" for which there is no value then an error appears how can I bypass the error.
Thanks
Private Sub DisTotal()
Dim query As String = "SELECT (DIS/BLC)*100 FROM RSG WHERE NOINV=@NOINV"
Try
Using con As OleDbConnection = New OleDbConnection(GetConnectionString)
con.Open()
Using cmd As OleDbCommand = New OleDbCommand(query, con)
cmd.Parameters.AddWithValue("@NOINV", ComboBox1.SelectedValue)
Dim DisTotal As Double = Double.Parse(lblDisTotal.Text)
'ERROR THIS BELOW LINE CODE
DisTotal = CDbl(cmd.ExecuteScalar().ToString())
End Using
End Using
Catch myerror As OleDbException
MessageBox.Show("Error: " & myerror.Message)
Finally
End Try
End Sub