I want an UltraGrid cell that allows only uppercase chars and the hyphen char.I achieved this by using the SendKeys.Send approach detailed in the Help.
This worked until I built and run my application in Debug|x86 on an x64 Windows7 machine with UAC turned on. On this machine the keypresses are just suppressed and the SendKeys.Send seems to have no effect.
If I disable UAC it works, if I change to Debug|Any CPU it works. Also a colleague with the same setup apart from an x86 Windows 7 does not seem to have the same issue whether he builds under x86 or Any CPU. If he runs the application built on my machine it works fine on his machine (but not on mine). If I run his build (Debug|x86) it does not work.
The problem seems to occur when application is built targetting x86 and then run on an x64 Windows7 machine with UAC on.
From what I gather SendKeys.Send is somewhat restricted by UAC in Windows 7 and is discouraged, so is there an alternative way to achieve what I want?
Hi,
Out of curiosity, do you get the same results if you use SendKeys and send keystrokes to some other control, like a TextBox, for example?
fluxmunki said:I achieved this by using the SendKeys.Send approach detailed in the Help.
What approach are you taking? What help topic are you referring to?
Yes, the same happens with a standard TextBox (run attached solution on Win7 x64 machine) so the issue itself is not an Infragistics one as such. However seeing as the help file mentions this method it should probably be caveated with this scenario that doesn't work.
One thing I forgot to mention is that I wanted automatic capitalisation of lowercase letters (hence the use of SendKeys). I have just found an alternative way of achieving this by handling the AfterEnterEditMode of the grid and capturing the TextBox via the ActiveCell.EditorResolved and setting the CharacterCasing to upper.
Therefore my issue is resolved. (The issue remains for other on-the-fly replacement of keypresses, but this does not currently affect me)
fluxmunki said:I have just found an alternative way of achieving this by handling the AfterEnterEditMode of the grid and capturing the TextBox via the ActiveCell.EditorResolved and setting the CharacterCasing to upper.
You can also just set the CharacterCasing property on the grid column.
BTW, I looked it up on MSDN and there is a note about UAC which explains that SendKeys will not work correctly in CLR2 when UAC is turned on, but that this is fixed in CLR3.
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx
Thanks Mike,
My sample app with just the textbox is built against .net 4.0, so I think it must be more complicated... seemed to be something to do with targeting x86 vs x64.
Re: setting character casing on the column, can't believe I missed that! Thanks!