Chris M
Member
- Joined
 - Feb 15, 2021
 
- Messages
 - 15
 
- Programming Experience
 - Beginner
 
Hi
I'm having trouble pasting text into a textbox by trapping the Control + V Keys in the textbox KeyDown event. KeyPreview for the form is set to True.
I've tried the following methods in the textbox keydown but neither works:
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The code(s) seem to trap one key but not both?
I'm sure there's a simple solution but I'm not seeing it - hope someone can help.
Thanks for looking,
Chris.
	
		
			
		
		
	
				
			I'm having trouble pasting text into a textbox by trapping the Control + V Keys in the textbox KeyDown event. KeyPreview for the form is set to True.
I've tried the following methods in the textbox keydown but neither works:
			
				VB.NET:
			
		
		
		If e.KeyCode = Keys.V AndAlso e.Modifiers = Keys.Control Then
    If Clipboard.ContainsText Then Me.Text_Convert.Text &= Clipboard.GetText
End If
	
			
				VB.NET:
			
		
		
		If e.KeyCode = Keys.V AndAlso (e.Control) Then
    If Clipboard.ContainsText Then Me.Text_Convert.Text &= Clipboard.GetText
End If
	The code(s) seem to trap one key but not both?
I'm sure there's a simple solution but I'm not seeing it - hope someone can help.
Thanks for looking,
Chris.