473,807 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finish textbox and grid editing on Menu click ?


This seems like an obvious one but it has me stumped.

I have a complex form with a bunch of databound grids and textbox
controls. There is a MainMenu control, and a toolbar control with
shortcuts to some of the most common commands - for instance, Save.

When I click on a toolbar control, I can catch the ItemClick event and
do a toolbar.Focus call to switch focus to the toolbar, thereby
pulling focus from whatever input control was previously focused.
This allows the LostFocus event to finish up whatever editing
operation was in, so that the Save command executes with all object
fields updated correctly.

But I can't figure out how to trap a similar event on the MainMenu
item. Do I really have to put a Focus call into every MenuItem.Click
event? That seems rather hacky; I'd be surprised if there's no way
to determine that the MainMenu has been clicked on or received focus
or something?

thanks!

elijah
Feb 16 '08 #1
2 1377
elijah,

I really cannot get what is your goal.

It sounds as it is the EndEdit (for version 2003 EndCurrentEdit because
there EndEdit has a bug) what you are looking for.

That pushes all data in the controls to the datasource.

Whatever focus there is on. (I am talking about Microsoft controls, I know
controls with bugs who don't do this).

Cor

Feb 16 '08 #2
ok - my goal is to pull focus from whatever control has it, when any
menuitem is clicked. This is so that the control with focus at the
time can validate before the menu command executes.

With the toolbar, I can handle the ItemClick event and execute
Toolbar.Focus to get this done. I'm wondering how to do a similar
thing with a MainMenu control, without putting code into every
MenuItem click event...
Feb 22 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1618
by: Shravan | last post by:
Hi, I saw that in Windows Forms DataGrid with new row creation set to true, if I have added a new row earlier which was empty and deleted the row and shifted the focus to any other control and then clicking on the column header of the grid is making the grid to go to edit mode which is causing the first row to be ready for allowing user input. Does anybody of you know how to stop this behaviour, i.e., new row should not be put into edit...
1
15754
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template columns to show some of the columns. Few of the columns have textboxes to make them available for editing. I am trying to update the dataset all at once using one update button. Here is my code... (for simplicity I have only listed one of the...
1
1870
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template columns to show some of the columns. Few of the columns have textboxes to make them available for editing. I am trying to update the dataset all at once using one update button. Here is my code... (for simplicity I have only listed one of the...
0
1665
by: Norbert | last post by:
Hi Can anybody help me ? I try to show popup menu when the right mouse button is clicked on ModHfGrid. I see the popup menu but when I click any option the click event of menuitem is not fired. I try with button (not ModHfGrid) and everything is ok. grid is as ModHFGrid control Private Sub grid_MouseDownEvent(ByVal sender As Object, ByVal e As
2
1717
by: Mad Scientist Jr | last post by:
I am editing an existing application that has a System.Windows.Forms.TreeView with a right-click menu with several options. I want to get rid of the TreeView alltogether and rip out the code for the right-click options and put these under different command buttons instead, but I am having trouble finding the code for the options. I remember in VB6 there was some kind of menu editor which gave the name of the subs for the menu options,...
0
1377
by: mutlyp | last post by:
I have a PreRender event to set the width of my textbox when the Edit button is pressed on my grid here is the code: Private Sub grdPBC_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdPBC.PreRender If grdPBC.EditItemIndex > -1 Then Dim tbx As TextBox tbx = CType(grdPBC.Items(grdPBC.EditItemIndex).Cells(4).Controls(0), TextBox) tbx.Width = Unit.Pixel(50) ...
2
11075
by: johnlim20088 | last post by:
Hi Someone please help me string typ; if (e.Row.RowType == DataControlRowType.DataRow) { typ = e.Row.Cells.Text;
0
3579
by: rehanmomin | last post by:
Just to start off, I am writing a web application using C#. I have a Menu which is binded to an XML datasource. There are three menu items each with submenus and a textbox where I want to display the value of the selected menu item. Heres the XML datasource that I am using: <?xml version="1.0" encoding="utf-8" ?> <Home> <Menu text="Patient" description=" "> <SubMenu text="First Name" description="firstName"></SubMenu> ...
2
12952
by: mrutyunjaya | last post by:
hello, i have two textbox column and one button control in gridvie when i click button it will ask plese enter price in first textbox . when enter values it is asking again. how to pass textboxid in javascript .my code is function validation() { alert("hi")
0
9599
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10626
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10112
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.