is it possible to make a picturebox the acceptbutton?
i tried this in form load
Dim picturebox1 As New Button Me.AcceptButton = picturebox1
is there a way i could do this?
So wait. When the use presses the Enter key, what do you want to have happen?
A bit confusing to understand, but since an Accept Button is like a Submit button on a Form, pressing the Enter key in any of the fields should press the Submit Button, in this case a PictureBox.
If so, see if the following code sample helps.
'//--------- Pre-requisites: 1 PictureBox, 3 TextBoxes. ---------\\ Public Class Form1 Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click MsgBox("PictureBox Clicked.", MsgBoxStyle.Information) End Sub '// use one event for multiple controls. Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _ Handles TextBox1.KeyUp, TextBox2.KeyUp, TextBox3.KeyUp If e.KeyCode = Keys.Enter Then PictureBox1_Click(sender, e) '// call the event procedure. End Sub End Class
So you want to raise the Picturebox1.Click event when the user presses the enter key?
Why not make a hidden button, make it your "accept button" and then use the following code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click PictureBox1_Click(sender, e) End Sub
Or just put the image in the .Image property of the button and clean the .text.
Resize the button to the image size.
Hope this helps
ahhh ok! you guys are smart! XD i didnt think about making a hidden button. good simple fix. its not important im just bored and made a stylish button using a picturebox.
EDIT-- the hidden button didnt work, but i followed code orders code and trigged the picturebox when enter key was pressed when the textbox has focus
Edited 6 Years Ago by eikal: n/a
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.
This is the result of previous question answered :
code for the listbox - datagridview interaction
At the top of the code ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...