Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:36:34+00:00 2026-06-08T17:36:34+00:00

I have a form which contains a button and a DataGridView. The button allows

  • 0

I have a form which contains a button and a DataGridView.

The button allows me to add a new person to the database :

DataRow drow = sql.ds.Tables["Etablissement"].NewRow();
            drow[1] = nom.Text; //drow[0] it's an auto-countign var
            drow[2] = string.IsNullOrEmpty(ville.Text) ? DBNull.Value : (object)ville.Text;
            sql.ds.Tables["Etablissement"].Rows.Add(drow);
            SqlCommandBuilder cmb = new SqlCommandBuilder(daEtablissement);
            daEtablissement.Update(sql.ds, "Etablissement");
            dgv.Refresh(); // dgv : DataGridView that i'm usign
            XtraMessageBox.Show("Bien Ajouter !");
            Videz();
            nom.Focus();

the problem is when the DataGridView is refreshed the code of the person I added doesn’t display, how can I solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:36:36+00:00Added an answer on June 8, 2026 at 5:36 pm

    The Refresh method is just a UI refresh and not data binding refresh. The best and simple way is to use a BindingSource which has your DataTable as a data source, and the BindingSource is set as the data source of the grid. Usually when you update the DataTable, the grid should show the new data, but if it doesn’t happen you can call BindingSource.ResetBindings(false)

    Code:

    BindingSource bindingSource = new BindingSource();
    bindingSource.DataSource = myDataTable;
    myGrid.DataSource = bindingSource;
    

    If for any reason updating the data table does not refresh the grid you can call:

    bindingSource.ResetBindings(false); // put true if your metadata has also changed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing site using codeigniter.I have a form which contains add button and
I have a form which contains a DataGridView, a BindingSource, a DataTable, and a
I have a form which contains 2 buttons , a datetimepicker and datagridview which
I have a workbook,which contains ActiveX control button and form control button and macros
I have a form which contains: <button class="submit">Submit</button> and jQuery code: $(".submit").click(function(e){ var evt
I have a web form(.net framework 4) which contains a submit button and a
I have a form (AddNewCamper), which contains a textbox and a submit button. In
I have a form which contains 4 text fields when the button is clicked
Using LWUIT, I have a Form (form1) which contains a Button (see the silver
I have a form which contains textboxes,search button. when user enter the values and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.