Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i want to a car park booking system, and i put picbox to let user click, my questions is how to use picbox to connect to sql 2014, i means i need to know which picbox the user have clicked, and it will auto record to sql 2014.

What I have tried:

Private Sub PictureBox10_Click(sender As Object, e As EventArgs)
If CType(sender, PictureBox).Image Is availableIcon Then
CType(sender, PictureBox).Image = provisionalIcon
ElseIf CType(sender, PictureBox).Image Is provisionalIcon Then
CType(sender, PictureBox).Image = availableIcon

End If
End Sub
Posted
Updated 2-Aug-18 21:41pm
Comments
CHill60 3-Aug-18 3:42am    
What have you actually tried in terms of saving data to your database? There is no connection code or anything here. We don't know your table structure either
Richard MacCutchan 3-Aug-18 4:09am    
You already posted this in the forums; please post in one place only.

1 solution

Use the sender parameter - it tells you the instance of the PictureBox that was clicked, if you have a number of picture boxes all being handled by the same event handler.

If you have each one being handled by a separate method as the method name in your code implies, then you already know which box was clicked, because it will go to a specific method!

As for your SQL problem, you will need to provide a whole load more info if you want help with that!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900