detect paste on text box - vb.net - vb.net

I have a text box and want to know if the data enter into is via pressing numeric keys or via a CTRL+V or via mouse right click.
Do not want to use windows message to process for paste/right click paste event.

You can use the KeyDown event to see whether Ctrl, then V was pressed (in two subsequent events).
You can use the MouseDown event to see whether the right mouse button was pressed.
You can use the KeyDown event to see if numeric keys were pressed.
If you use a flag for these three cases, then check it in the TextChanged event, you can determine where the text likely came from.

Related

Vuetify v-select how to call change only when user select an option?

Currently the v-select change event will fires multiple times during user typing keywords.
Is there any event will be only fired if user has select an option or press Enter to select an option.
I don't want the change event be fired during user typing keywords.
V-Select#Events
Unfortunately, it looks like the change event only has a parameter that is the value of selected option. There is not event passed through for you to check what actually raised the change event. However, looking at the link above, there are other events you can use.
There is a keydown event listed here that you might be able to leverage. It takes in a keyboard event, you should be able to check what keyboard event was raise i.e. 'Enter'. There are also other events such as mousedown or mouseup.

KeyDown : detect either control key alone or control key used as a modifier

The user will type in a datagridview the shortcuts he would like to assign to a couple of operations. I tried to use KeyDown event when the cell is in edit mode.
However I want my control to be able to detect in the same event handler the Control key typed alone, or the Control key used as a modifier (same with Shift and Alt).
This causes a problem since KeyDown fires up when Control is down before the other key I am combining it with is also down. Obviously the event handler doesn't know if the user intends on pressing another key after the Control key.
Right now I solved this issue by using KeyUp, but this caused other headaches when for example the user types in CTRL+P, releases P, which fires the correct event, but then the user releases Ctrl which fires a new KeyUp event which I had to find a way to ignore.
There must be a cleaner way to handle this?

Triggering Visual Basic Keydown events without a specific function

I'm building on top of code that a previous developer has left me, and he left something that intrigued me quite a bit.
Basically on his menus, he has a TextBox to take in user input and a button next to it to submit the value of the TextBox (for example if the user wanted to select option 1, he would input 1 into the TextBox and click the button). However, the user could also press the Enter key while focusing the TextBox, and it would be treated as the submit button was clicked.
Now this is simple enough to do, but when I check the VB code behind the menu, there's no TextBox_Keydown(...) Handles TextBox.Keydown function anywhere, only the button click event. How is he doing this? He has several menus that are similar and I can't figure out how.
A standard dialog box, if not told to act otherwise, enter does default command button and escape does cancel. In VB look at the properties Default for the command button.
I discovered how he was doing it. He basically mapped the AcceptButton and CancelButton properties of the entire Windows Form to various button functions.

How to use Button.KeyPress in vb

what I can do to execute Button.KeyPress event in vb ?
for example
Button.Click , should I press the button , so what about Button.KeyPress
Assuming you're talking about Runtime, in order to get the KeyPress event to fire, the Button needs to be first be selected, then press a (keyboard) button.
The KeyPress is normally used for things like a Textbox, it's not normally used with a Button
If you are looking for a way to force the Button.Click event, you can always call Me.Button1.PerformClick()

DevExpress VerticalGrid Validate event and behavior with RadioButton cell editors

I'm using the VerticalGrid in MultiRecordView. Its Validate event fires when the grid detects that a record that has been changed is losing focus. I'm writing data to the database from this event.
My users want to use the keyboard left/right arrow keys to move forwards and backwards through the recordset, so I trap those keys and set the FocusedRecord accordingly.
If one of the row editors is a RepositoryItemRadioButton, the Validate event doesn't always fire. The users will click on the radio-button value desired and then, before they click on another row in the record, they'll hit the arrow key to move to the next record. The change to the radio button group has not been detected by the grid in that sequence of events.
The radio button change is detected only when the button loses focus.
Is there a way to cause the vertical grid to recognize that a radio button editor has been changed and fire the Validate event, if the user doesn't give another row in the record the focus?
I thought EditValueChangedFiringMode property controlled that behavior, but setting it to Default or to Buffered does not have the desired effect.
Thanks