Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Binding Navigtor commands to put into a drop down menu
 

Binding Navigtor commands to put into a drop down menu

How do you codea drop down menu with the first, next, previous, and last records?
MyDale3  Monday, August 03, 2009 1:14 AM
Hi MyDale3,

Do you mean your menu item will perform the same task as the BindingNavigator's button? So that your user can either click BindingNavigator's button or click your menu item to do the work?

The easiest way to accomplish this is click the BindingNavigator's button in your code. Like this.
private void nextToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorMoveNextItem.PerformClick();
}

private void previousToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorMovePreviousItem.PerformClick();
}

private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorAddNewItem.PerformClick();
}

private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorDeleteItem.PerformClick();
}
So when user click your menu item, it is equal to click BindingNavigator's button.

If I misunderstood something, please feel free to tell me.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Wednesday, August 05, 2009 2:52 AM
Hi MyDale3,

Do you mean your menu item will perform the same task as the BindingNavigator's button? So that your user can either click BindingNavigator's button or click your menu item to do the work?

The easiest way to accomplish this is click the BindingNavigator's button in your code. Like this.
private void nextToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorMoveNextItem.PerformClick();
}

private void previousToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorMovePreviousItem.PerformClick();
}

private void addToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorAddNewItem.PerformClick();
}

private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
bindingNavigatorDeleteItem.PerformClick();
}
So when user click your menu item, it is equal to click BindingNavigator's button.

If I misunderstood something, please feel free to tell me.

Sincerely,
Kira Qian
Please mark the replies as answers if they help and unmark if they don't.
Kira Qian  Wednesday, August 05, 2009 2:52 AM

You can use google to search for other answers

Custom Search

More Threads

• DataGridView Mandatory Column
• Edit only Page 1 of GridView with DetailsView
• Refreshing a data source
• Binding Child Records to Unbound Datagridview
• get data to textfield from dataset
• Cannot connect to MsAccess using .Net FrameworkData Provider for OLE DB
• Inefficiency in DataGridView
• windows service
• Validate Cell Value in Datagridview
• C# .net2.0 dataset problem