|
-
Feb 5th, 2009, 02:35 AM
#1
Thread Starter
Lively Member
BindingNavigator and Bindingsource control
Hi, I have one datagridview control, a BindingNavigation and a Binding control on my form. I populate the datagridview control through the code. Moreover, the datasource properties of the DatagridView and the Binding controls are assigned a value through code (I didn't specify anyting in the properties window). The same for the bindingsource property of the BindingNavigation control (I assign a value trhough code). My code is the following:
objDataAdapter.SelectCommand = New SqlCommand()
objDataAdapter.SelectCommand.Connection = objConnection
objDataAdapter.SelectCommand.CommandText = _
"SELECT Code, Description, BarCode, MM, Remainder FROM Table_1 "
objConnection.Open()
objDataAdapter.Fill(objDataSet, "Table_1")
objConnection.Close()
BindingSource1.DataSource = objDataSet
DataGridView1.AutoGenerateColumns = True
DataGridView1.DataSource = objDataSet
DataGridView1.DataMember = "Table_1"
BindingNavigator1.BindingSource = BindingSource1()
This code brings and shows the right results in the datagridview control, but the navigator control is inactive. I know that I have to bind the controls(DataGridView + BindingNavigator) to the BindingSource control. Is this a problem that I tried to do this by coding? Any solutions?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|