ledgerr.rob
Registered User.
- Local time
- Yesterday, 19:28
- Joined
- Jun 3, 2012
- Messages
- 68
I have a form with an image control on it that displays linked images/pdfs. I also have two text boxes that are automatically filled in with the 1. file path and 2. file name. Kinda over kill and i'm sure i'll remove one or both once i get this smoothed out.
What i would like is if someone (namely me) makes a mistake and adds the incorrect pdf, and they would like to delete (using backspace key) the image, then 1. text boxes are emptied and 2. the image/pdf is also removed.
here is the code I have.
i was under the impression that if i didn't explicitly cancel the command or set the KeyAscii to 0 then the original functionality of the button pressed would still be executed. i'm now guessing this assumption is wrong...
Any tips?
What i would like is if someone (namely me) makes a mistake and adds the incorrect pdf, and they would like to delete (using backspace key) the image, then 1. text boxes are emptied and 2. the image/pdf is also removed.
here is the code I have.
Code:
Private Sub imgESCP_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
'display message box with comment
MsgBox "You pressed the BACKSPACE key."
'set focus to file path text box and set to empty
'this works
txtESCPFilePath.SetFocus
txtESCPFilePath.Text = ""
'set focus to file name text box and set to empty
'this works
txtESCPName.SetFocus
txtESCPName.Text = ""
'remove the image from the image control
'this does not work
imgESCP.SourceDoc = ""
End If
End Sub
i was under the impression that if i didn't explicitly cancel the command or set the KeyAscii to 0 then the original functionality of the button pressed would still be executed. i'm now guessing this assumption is wrong...
Any tips?