title: Why is my Nullable(Of Int32) = 0 after I set it to Nothing?
body: <p>I think I'm missing something fundamental about nullable types. Hopefully this example will open up new understanding, but at the very least, maybe we can get this one thing working right.</p>
  
  <p>In a Class (a dialog form), I declare:</p>
  
  <pre><code>Property ProductStructureHeaderKey As Int32?
  </code></pre>
  
  <p>In another Class, I declare an instance of that dialog and attempt to set that Property with this line:</p>
  
  <pre><code>    dr.ProductStructureHeaderKey = If(parentRow.Cells(1).Value Is Nothing, Nothing, Int32.Parse(parentRow.Cells(1).Value))
  </code></pre>
  
  <p>When that line assigns Nothing to the property, the property is equal to 0. (And then later, it's passing 0 to the DB when I want it passing NULL.)</p>
  
  <p>That's not what I expect and I keep finding code (SO, MSDN, etc) that looks like I'm doing things right, but clearly, I'm not. So, friends, what am I doing wrong? How do I employ Nullable types to meet my needs?</p>