protected override void CreateNavToolBar() { // create the NavToolBar base.CreateNavToolBar(); // then set the bindings int ButtonCount = NavToolBar.Items.Count; for (int i = 0; i < ButtonCount; i++) { mmToolStripButton b = (mmToolStripButton)NavToolBar.Items[i]; // using new form mmDataGridView property NavDataGrid // set to the the same DataGrid as NavControl // 1) to get binding source here // 2) to get DataView for checking order in NavigateNew() b.BindingSource = this.NavDataGrid.BindingSource; b.BindingSourceMember = this.NavDataGrid.BindingSourceMember; // causes error } }The error happens here:
/// <summary> /// Binds the simple binding control to the specified DataSet and DataTable /// </summary> /// <param name="mmControl">Control to be bound</param> /// <param name="ds">DataSet</param> /// <param name="tableName">DataTable</param> /// <param name="fieldName">Field name</param> /// <param name="bizObj">Business object associated with the control</param> public static void BindData(ImmBindingSimple mmControl, DataSet ds, string tableName, string fieldName, mmBusinessObject bizObj) { // Cast the control to System.Windows.Forms.Control Control control = (Control)mmControl; // <---- error!!!