set focus to form

Micro

Member
Joined
May 23, 2013
Messages
8
Programming Experience
Beginner
hi,
In my vb.net project I have a data grid to show data,on button click new data is added to grid. I have used a picture box as a button and want the entering process to be done by Keyboard Enter key press.
I used the forms key down event to recognize Enter key pressed and called the function to be executed. This works but after I select the grid cell for manual editing it do not work!!
To access form 's key down event form should get focused what should I do?
 
what should I do?
Not use a PictureBox in the first place. You can inherit the Button class and make it look however you want, but it will still work like a regular Button so there's no extra work to do.

If you're determined to use your current hack then I would have thought that setting the KeyPreview property of the form to True would be enough. If it's not then you'll have to handle the event of the grid's editing control as well.
 
Hi,
in this project I changed the picture box to simple button, assign acceptbutton property of form to button and focus is set to button after grid cell value is changed.It is working but I have created setup of project and while installing it error comes as 'could access network location < setup name > I am working on win 7.For the old project it is working!! what should be the issue? pls help..
on searching on net about registry I found, but confused.
 
Back
Top