Bound datagridview not updating datasource

However, if you select another table and then come back to the previous table, the datagridview only displays the column headings and not any of the rows of data.

I have been searching for a solution to this problem for 2 hours with no luck.

A simple dt.clear() only clears the rows from the datatable but leaves the columns in it.

When you use data-bound controls, you sometimes have to respond to changes in the data source when the data source does not raise list-changed events. Private label1 As Label Private label2 As Label Private text Box1 As Text Box Private text Box2 As Text Box Private With Events button1 As Button Private binding Source1 As Binding Source Private states As Array List Public Sub New() ' Basic form setup.

using namespace System; using namespace System:: Collections:: Generic; using namespace System:: Component Model; using namespace System:: Data; using namespace System:: Drawing; using namespace System:: Text; using namespace System:: Xml; using namespace System:: Windows:: Forms; using namespace System:: IO; namespace System_Windows_Forms_Update Binding int main() Imports System.

Collections Class Form1 Inherits Form ' Declare the objects on the form.

When you use the Binding Source component to bind your data source to a Windows Forms control, you can notify the control that your data source has changed by calling the Reset Bindings method.

The following code example demonstrates using the Reset Bindings method to notify a bound control about an update in the data source.

Search for bound datagridview not updating datasource:

bound datagridview not updating datasource-53bound datagridview not updating datasource-52bound datagridview not updating datasource-45bound datagridview not updating datasource-8

I also tried, in conjunction with your suggestion, setting bs.datasource = null rigth after dt.clear() but this doesn't seem to effect anything.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “bound datagridview not updating datasource”