I want to change the direction of writing in textbox by using Alt+Shift Keys. so this will need every time press on these keys, so I want to insert in the texbox's event a code Can Implement Alt+Shift.
Printable View
I want to change the direction of writing in textbox by using Alt+Shift Keys. so this will need every time press on these keys, so I want to insert in the texbox's event a code Can Implement Alt+Shift.
Inside your textBox's or forms keypress event use an if statement to check if the key combination alt+shift is being pressed and if so change the writing direction inside the if.
How to do this.
In the keydown event, check if the shift button is being pressed. If it is, check a boolean value to determine if the alt key was pressed just before that.
If the shift button is not being pressed, check if the alt key is being pressed. If it is, set a boolean variable to true to prime for the shift key.
Yeah, Maximilian pretty much said it... A note of caution though, Alt+Shift is used as a global shortcut by the OS (it changes the current language and keyboard layout). Using it inside your application as well may result in unwanted and unpredictable behaviour.
How to check ....?
Don't risk it, choose something else. Alt+R or something.
Well you cannot possibly check it out under all possible circumstances... What you can do is code it and then try running the app under your current system configuration and see how well it performs (a run outside of the debugger would be preferable in my book). If it's an app for personal use only it should be enough, but if you are planning commercial deployment, a switch to a different key combination would be wiser. Ultimately, it's your call...:thumb:Quote:
Originally Posted by nader
I'm so sorry. I can't understand anything. I'm newbie.
Any way thank you for help!
Well, are you developing the application for your own use only or do you plan on letting other people use it as well?
I'm working on creating a project for store(accounting ). and it required thisQuote:
Originally Posted by obi1kenobi
Well then select a different key combination, for example the already-suggested Alt+R. It doesn't matter which combination you choose, the code will not suffer major changes.
Here is a code to implement alt+shift
I want the inverse of that code.vb Code:
If e.Alt And e.Shift Then MsgBox(" change the direction of pointer") End If
vb Code:
Private Sub TextBox1_TextChanged 'implement this instead of user e.Alt And e.Shift End sub
I am sorry, I did not understand your last post. :( Would you mind clarifying a bit? What do you mean by inverse of the code?
vb Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.KeyPreview = True End Sub Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown If e.Alt AndAlso e.Shift Then Me.TextBox1.RightToLeft = Windows.Forms.RightToLeft.Yes End If End Sub End Class
That code work when the user press on the keys alt+shiftQuote:
Originally Posted by obi1kenobi
inverse mean: the code must execute ( press ) the alt+shift.
And why would you want to press the Alt+Shift through code? I guess you could do it with SendKeys or some direct API calls, but it's a bit outside my playing field...
Does he want a hotkey or something?
The alt+shift fix the problem of the pointer in this thread:hard questionQuote:
Originally Posted by obi1kenobi
http://www.vbforums.com/showthread.php?t=542889