title: Add row to gridview from a button c# VB.FORM
body: <p>Good morning, I am trying to add from 1 button 1 new row to my gridview form in c # vb.net and sql server, but I can't find the function to add 1 new row to the gridview using a button</p>
  <p><a href="https://i.stack.imgur.com/eeTfG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eeTfG.png" alt="enter image description here" /></a></p>
  <p>So far I have only shown the records to the gridview this is my code to display data.</p>
  <pre><code> private void txtcod_TextChanged(object sender, EventArgs e)
      {
          if (txtcod.Text == &quot;&quot;)
          {
  
  
  
          }
          else {
  
              this.dgvcontactos.DataSource = negCli.DatosContacto(MODULOS.Globales.Base, txtcod.Text);
          
          }
      }
  </code></pre>
  <hr />
  <p>this is my data_layer where I have 1 function that calls a stored procedure</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>  public DataTable Contactos_ClieProvs(String basesita, String codClie)
          {
              DataTable dt = new DataTable();
              try
              {
                  SqlConnection cnn = new SqlConnection(conexion.CargarBase(basesita));
                  SqlCommand cmd = new SqlCommand("execute CONTACTOS @tipo=13,@IdClieProv='" + codClie + "'", cnn);
                  //cmd.CommandTimeout = 0;
                  SqlDataAdapter da = new SqlDataAdapter(cmd);
                  try
                  {
                      if (cnn.State == ConnectionState.Closed)
                      {
                          cnn.Open();
                      }
                      else
                      {
                          cnn.Close();
                          cnn.Open();
                      }
                      da.Fill(dt);
                  }
                  catch (SqlException ex) { throw ex; }
                  finally
                  {
                      cnn.Close();
                  }
              }
              catch (SqlException ex1) { throw ex1; }
              return dt;
          }</code></pre>
  </div>
  </div>
  </p>
  <p>Through a stored procedure in my database, a select * from contacts, I am working with N layers, all good up to that point, what I want is by means of a button to add 1 row to the gridview once the row that is saved with the save button is filled, they will have any ideas.</p>