C#datagirdview, assign a value in DataSource mode, and then update the problem

Source: Internet
Author: User

Let's start with the procedure.

Main form, two subforms, a, B. Inside the panel that is embedded in the main form

Main form, start the lookup method in Class C, find the value, send to form a by event delegate

The C class also modifies the query table and sends the modified query table through the event delegate to form B.

The program runs the first pass, the steps, the main form query, and the A/b form is displayed normally.

The second time, the a form is displayed normally, and the B form does not display properly. Content not updated

AB window is a DataGridView control

The second reason for the failure is that the B form is passed by the Class C driver, the Class C is not a class with the main form, the content is updated and the DataGridView is not updated, and the DataGridView is updated by datasource the data source bindings, Modified data source, re-assignment is not updated, there are related articles on the Internet, as for a

The second time the form succeeds, it may be the main form directly driven. I can't explain the specific reason.

The problem is on the DataGridView update, through DataGridView. Rows.clear (); Prompt data source binding method assignment, is not able to be deleted through the market, so I in the B form below the class used Datagridview=null, and then datasource= the new data source. Result problem solved,

As for a why not NULL update success? Still some don't understand, is it associated with the update mechanism of the main form? Look forward to a view

I looked again. The properties of the DataGridView list in the B-window are displayed normally for the first time, and the second has no corresponding situation

Table for first query

Table for second query

The property of the B table is the second time "sweep quantity" becomes "Quantity", which is the number of data sources bound

B DataGridView Properties of the second case number

Is there a problem here that doesn't correspond?

Unify the two above and not assign NULL to the B list. The result is still not updated. Should be related to the update mechanism of the main form.

C#datagirdview, assign a value in DataSource mode, and then update the problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.