title: DataRow ArrayItem's DataType for NULL Values vb.net
body: <p>I am undergoing a scenario where I have DataTable and there are multiple types of columns in it, I have to filter out the Data Type of Null Valued Column so i can assign some default value to it, right now there is nothing to trap. Below is the Code for Testing.</p>
  
  <pre><code>Public Class Form1
  
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Dim table As DataTable = GetTable()
      '
      ' We can instantiate a new object array and add it as a row.
      '
      Dim row As DataRow = table.Rows(1)
      For Each item As Object In row.ItemArray
          If TypeOf item Is Integer Then
              Console.WriteLine("Int: {0}", item)
          ElseIf TypeOf item Is String Then
              Console.WriteLine("String: {0}", item)
          ElseIf TypeOf item Is DateTime Then
              Console.WriteLine("DateTime: {0}", item)
          ElseIf TypeOf item Is System.DBNull Then
              Console.WriteLine("DBNULL {0}", item)
          End If
      Next
  End Sub
  Private Shared Function GetTable() As DataTable
      ' Here we create a DataTable with four columns.
      Dim table As New DataTable()
      table.Columns.Add("ID", GetType(Integer))
      table.Columns.Add("Name", GetType(String))
      table.Columns.Add("Desc", GetType(String))
      table.Columns.Add("Date", GetType(DateTime))
  
      ' Here we add five DataRows.
      table.Rows.Add(1, "Abc", "Cool Down", DateTime.Now)
      table.Rows.Add(2, "Chenno", "Helifire", DBNull.Value)
      Return table
  End Function
  </code></pre>
  
  <p>End Class</p>
  
  <p>I am traversing only the Null Valued Column Row, For date Column it shows "System.DBNull" . i need to figure out this column's datatype.</p>