Toolbar or BindingNavigator?
-
I am in the process of designing a generic 'record maintenance' toolbar class containing the 'standard' add/edit/delete/save/cancel buttons. I notice that the VS toolbox already has a bindingnavigator control which already has some of the functionality that I require (although I don't require the navigation buttons). Which control should I go for? As far as I can see the bindingnavigator is just a glorified toolbar bound directly to a datasource, but I may be missing something. Can I subclass a toolbar/bindingnavigator visually or does it have to be done in code? I am using C# with VS2005 express. TIA Alan
-
I am in the process of designing a generic 'record maintenance' toolbar class containing the 'standard' add/edit/delete/save/cancel buttons. I notice that the VS toolbox already has a bindingnavigator control which already has some of the functionality that I require (although I don't require the navigation buttons). Which control should I go for? As far as I can see the bindingnavigator is just a glorified toolbar bound directly to a datasource, but I may be missing something. Can I subclass a toolbar/bindingnavigator visually or does it have to be done in code? I am using C# with VS2005 express. TIA Alan
aharrisreid wrote:
I am in the process of designing a generic 'record maintenance' toolbar class containing the 'standard' add/edit/delete/save/cancel buttons. I notice that the VS toolbox already has a bindingnavigator control which already has some of the functionality that I require (although I don't require the navigation buttons). Which control should I go for? As far as I can see the bindingnavigator is just a glorified toolbar bound directly to a datasource, but I may be missing something. Can I subclass a toolbar/bindingnavigator visually or does it have to be done in code? I am using C# with VS2005 express.
You can just use Windows Forms' BindingSource and create a decent ToolStrip (previously known as ToolBar in .NET 1.x), with your own buttons with custom actions. Any data binding applications in Windows Forms can do navigating by just using BindingSource with a valid DataSource such as DataSet or DataTable. Start from this: http://msdn2.microsoft.com/en-us/library/ef2xyb33.aspx[^] Eriawan
-
aharrisreid wrote:
I am in the process of designing a generic 'record maintenance' toolbar class containing the 'standard' add/edit/delete/save/cancel buttons. I notice that the VS toolbox already has a bindingnavigator control which already has some of the functionality that I require (although I don't require the navigation buttons). Which control should I go for? As far as I can see the bindingnavigator is just a glorified toolbar bound directly to a datasource, but I may be missing something. Can I subclass a toolbar/bindingnavigator visually or does it have to be done in code? I am using C# with VS2005 express.
You can just use Windows Forms' BindingSource and create a decent ToolStrip (previously known as ToolBar in .NET 1.x), with your own buttons with custom actions. Any data binding applications in Windows Forms can do navigating by just using BindingSource with a valid DataSource such as DataSet or DataTable. Start from this: http://msdn2.microsoft.com/en-us/library/ef2xyb33.aspx[^] Eriawan
Hi kuyak2000, thanks for the reply.
You can just use Windows Forms' BindingSource and create a decent ToolStrip (previously known as ToolBar in .NET 1.x), with your own buttons with custom actions.
The problem with the BindingSource is that I don't require the navigation buttons, which only leaves the add and delete buttons, so I would have to add my own edit/save/cancel buttons. It might make more sense for me to create my own customised toolstrip. Regards, Alan
-
Hi kuyak2000, thanks for the reply.
You can just use Windows Forms' BindingSource and create a decent ToolStrip (previously known as ToolBar in .NET 1.x), with your own buttons with custom actions.
The problem with the BindingSource is that I don't require the navigation buttons, which only leaves the add and delete buttons, so I would have to add my own edit/save/cancel buttons. It might make more sense for me to create my own customised toolstrip. Regards, Alan
aharrisreid wrote:
The problem with the BindingSource is that I don't require the navigation buttons, which only leaves the add and delete buttons, so I would have to add my own edit/save/cancel buttons. It might make more sense for me to create my own customised toolstrip.
Using VS 2005 IDE, you can just add BindingSource by dropping from toolbox, and then start to create your own ToolStrip with your own data manipulation buttons. Dropping BindingSource doesn't create new BindingNavigator on your Form. regards, Eriawan :)
-
aharrisreid wrote:
The problem with the BindingSource is that I don't require the navigation buttons, which only leaves the add and delete buttons, so I would have to add my own edit/save/cancel buttons. It might make more sense for me to create my own customised toolstrip.
Using VS 2005 IDE, you can just add BindingSource by dropping from toolbox, and then start to create your own ToolStrip with your own data manipulation buttons. Dropping BindingSource doesn't create new BindingNavigator on your Form. regards, Eriawan :)
Hi Eriawan, thanks for the reply.
kuyak2000 wrote:
Using VS 2005 IDE, you can just add BindingSource by dropping from toolbox, and then start to create your own ToolStrip with your own data manipulation buttons. Dropping BindingSource doesn't create new BindingNavigator on your Form.
I think I understand what you are saying, but how do I use toolstrip buttons in conjunction with the bindingsource to achieve the required action? For example, say I have a 'Save' button on the strip. What sort of code would it have called from the Click method which saves data back to the database? Can you point me to any examples? Any help would be appreciated. Alan
-
Hi Eriawan, thanks for the reply.
kuyak2000 wrote:
Using VS 2005 IDE, you can just add BindingSource by dropping from toolbox, and then start to create your own ToolStrip with your own data manipulation buttons. Dropping BindingSource doesn't create new BindingNavigator on your Form.
I think I understand what you are saying, but how do I use toolstrip buttons in conjunction with the bindingsource to achieve the required action? For example, say I have a 'Save' button on the strip. What sort of code would it have called from the Click method which saves data back to the database? Can you point me to any examples? Any help would be appreciated. Alan
It's quite easy. - First you have to validate the form using Form.Validate() method, - End the edit of bindingsource used using BindingSource.EndEdit() method. - Save the datasource. If you're using TableAdapter, just use Update() method Good luck! best regards, Eriawan :)
-
It's quite easy. - First you have to validate the form using Form.Validate() method, - End the edit of bindingsource used using BindingSource.EndEdit() method. - Save the datasource. If you're using TableAdapter, just use Update() method Good luck! best regards, Eriawan :)
Hi Eriawan, That was easier than I thought it would be. I'll try it out asap.. Thanks, Alan