title: Conversion from type 'DBNull' to type 'Decimal' is not valid. - issue when Datagridview loads data from DB
body: <p>I am trying to load data into datagridview in visual basic but getting this error.</p>
  
  <p>Conversion from type 'DBNull' to type 'Decimal' is not valid. - Problem when Datagridview loads data from DB,</p>
  
  <p>Please when writing a response bear in mind I am a complete newbie. </p>
  
  <p>And by the way I have tried to add .ToString after a Value on some of the , </p>
  
  <pre><code>Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
      Dim i As Integer
  
      Me.TextBox1.Text = DataGridView1.Item(0, i).Value.ToString
      Me.TextBox8.Text = DataGridView1.Item(1, i).Value.ToString
      Me.TextBox9.Text = DataGridView1.Item(2, i).Value.ToString
      Me.TextBox11.Text = DataGridView1.Item(3, i).Value.ToString
      'valoren_code'
      Me.TextBox3.Text = DataGridView1.Item(4, i).Value.ToString
      Me.TextBox13.Text = DataGridView1.Item(5, i).Value.ToString
      Me.TextBox15.Text = DataGridView1.Item(6, i).Value.ToString
      Me.TextBox14.Text = DataGridView1.Item(7, i).Value.ToString
      Me.NumericUpDown6.Value = DataGridView1.Item(8, i).Value.ToString
      Me.DateTimePicker2.Text = DataGridView1.Item(9, i).Value.ToString
      Me.ComboBox1.SelectedItem = DataGridView1.Item(10, i).Value.ToString
      Me.ComboBox8.SelectedItem = DataGridView1.Item(11, i).Value.ToString
      Me.ComboBox2.SelectedItem = DataGridView1.Item(12, i).Value.ToString
      Me.ComboBox3.SelectedItem = DataGridView1.Item(13, i).Value.ToString
      Me.ComboBox4.SelectedItem = DataGridView1.Item(14, i).Value.ToString
      Me.ComboBox5.SelectedItem = DataGridView1.Item(15, i).Value.ToString
      Me.ComboBox6.SelectedItem = DataGridView1.Item(16, i).Value.ToString
      Me.ComboBox7.SelectedItem = DataGridView1.Item(17, i).Value.ToString
      Me.ListBox1.SelectedItem = DataGridView1.Item(18, i).Value.ToString
      Me.NumericUpDown8.Text = DataGridView1.Item(19, i).Value.ToString
      Me.NumericUpDown7.Text = DataGridView1.Item(20, i).Value.ToString
      Me.NumericUpDown5.Text = DataGridView1.Item(21, i).Value.ToString
      Me.NumericUpDown13.Text = DataGridView1.Item(22, i).Value.ToString
      Me.NumericUpDown14.Value = DataGridView1.Item(23, i).Value.ToString
      'mid_trade_clean_price_proximity
      Me.NumericUpDown15.Value = DataGridView1.Item(24, i).Value.ToString
      Me.NumericUpDown16.Value = DataGridView1.Item(25, i).Value
      Me.TextBox2.Text = DataGridView1.Item(26, i).Value.ToString
      Me.ListBox3.SelectedItem = DataGridView1.Item(27, i).Value.ToString
  End Sub 
  </code></pre>