title: Specifying Value Range for Grid Value VB.NET
body: <p>How can I avoid getting this warning ? If warning and code stays as below, will the software throw run time error ? Which is better way to write this code ? Since I cannot use Minimum and Maximum for Grid value, I have to use only .Value due to which I have written following code.</p>
  <pre><code>Select Case CSng(dgv_config.Item(dgv_config.Columns(&quot;p&quot;).Index, rowindex).Value)
                          
  Case 1 To 150
  
  #Disable Warning BC42019 ' Operands of type Object used for operator
                              If dgv_config.Item(dgv_config.Columns(&quot;tsamp&quot;).Index, rowindex).Value &gt; 400 Then
  #Enable Warning BC42019 ' Operands of type Object used for operator
                                  dgv_config.Item(dgv_config.Columns(&quot;tsamp&quot;).Index, rowindex).Value = 400
                              End If
  #Disable Warning BC42019 ' Operands of type Object used for operator
                              If dgv_config.Item(dgv_config.Columns(&quot;tsamp&quot;).Index, rowindex).Value &lt; 50 Then
  #Enable Warning BC42019 ' Operands of type Object used for operator
                                  dgv_config.Item(dgv_config.Columns(&quot;tsamp&quot;).Index, rowindex).Value = 50
                              End If
  End Select
  </code></pre>