|
This[^] was my first hit when I googled. BTW, this question has to be in ASP.NET forum.
|
|
|
|
|
I want my app to have a few global functions that are performed whenever certain keys are pressed. That's easy to do as long as a certain control has focus, but as soon as one of the other numerous controls on my form receives focus, the key press events are no longer fired for the control that cares, with the events instead firing for whatever random control happens to have focus.
The pull-down menu controls seem to have solved this problem because they process Alt presses regardless of what control has focus. Does anyone know how I can do this too?
Thank you!
|
|
|
|
|
Set the form's KeyPreview property to true and you can handle all the key presses in the form's various key events rather than using the individual control's.
Dave
|
|
|
|
|
Hi All,
How can i know from the keyboard scan code what is the real key ?
I using KBDLLHOOKSTRUCT Structure in my keyboard hook to get the pressed keyboard information - But i still don't understand how can i know what the meaning of the key that was pressed even if i know the scanCode of the pressed key.
I don't want to use "switch..case" to check for each option pair So ... i looking some .net Framework class ( or win32 function ) that can find the value of the scanCode of the pressed key.
Beside this - how can i know if the key that pressed is 'A' or 'a' or '5' pr '%' - ?
Thanks for the help
|
|
|
|
|
Hi
i have the situation to fetch similar values using fuzzy lookup. here i dont know how to pass variables which contains input values[comes from my application] to the fuzzy look up without using datasource.
Can anyone tell how?
thanks in advance
sari
|
|
|
|
|
I have no idea what you're asking. What fuzzy lookup ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi
How to delete record using check boxes in datagrid.
that is if check box is checked the record should be deleted and again when checkbox is checked the record must undelete.when the record is deleted the "edit" command of datagrid must deactivate.
iam using stored procedures to delete records that is updating flags.
can any one help me in coding.
thanks
|
|
|
|
|
I guess you need to have a deleted flag ( if you delete records from the DB, you cannot undelete ). Then it's easy, all flags are set by the checkbox value, on or off.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
I have 3 form in my application: fMain,fA,fB, Where create object fA() and fB() in fMain to use delegate.
fMain <---delegate---> fA
<---delegate---> fB
Now, i would like to force to refresh fB when fA was edited. How can i do it?
Any tips are welcome.
regards
cocoonwls
|
|
|
|
|
OK, I have an app which uses windows media player as a control. I need to build a 64 bit version. However, when I set the target to 64 bit, it says the build succeeded, but no code files are in the target directory. I think that may be because a setting is wrong, but when I fix it, I get this:
Error 49 An attempt was made to load an assembly with an incorrect format: E:\Source code\OVS\DiagnosticImagingAssistant\obj\x64\AussieRelease\DiagnosticImagingAssistant.exe. E:\Source code\OVS\DiagnosticImagingAssistant\SGEN DiagnosticImagingAssistant
Also a bunch of warnings like this:
Warning 33 Assembly generation -- Referenced assembly 'System.Data.dll' targets a different processor DiaFileWatcher
Warning 34 Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor DiaFileWatcher
Do I need to be on a 64 bit version of windows to build 64 bit ? If it just errors out, what's the point of having the setting ?
It's actually complaining that a dll I wrote, which is being built as 64 bit, and imports windows media player, is the wrong format:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\sgen.exe /assembly:"E:\Source code\OVS\DiagnosticImagingAssistant\obj\x64\AussieRelease\DiagnosticImagingAssistant.exe" /proxytypes /reference:..\Odyssey.Windows.Controls\bin\x64\AussieRelease\AxInterop.WMPLib.dll /reference:..\OVSCommon\bin\x64\AussieRelease\Interop.DexterLib.dll /reference:..\Odyssey.Windows.Controls\bin\x64\AussieRelease\Interop.WMPLib.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:..\Odyssey.Windows.Controls\bin\x64\AussieRelease\Odyssey.Windows.Controls.dll /reference:..\Odyssey.Windows.Controls\bin\x64\AussieRelease\Odyssey.Windows.Forms.Controls.dll /reference:..\OVSCommon\bin\x64\AussieRelease\OVSCommon.dll /reference:..\OVSImaging\bin\x64\AussieRelease\OVSImaging.dll /reference:..\OVSCommon\bin\x64\AussieRelease\PresentationCore.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\ReachFramework.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.EnterpriseServices.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.IdentityModel.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Management.dll /reference:..\OVSCommon\bin\x64\AussieRelease\System.Printing.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.ServiceModel.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\UIAutomationProvider.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\UIAutomationTypes.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll"
SGEN : error : An attempt was made to load an assembly with an incorrect format: E:\Source code\OVS\Odyssey.Windows.Controls\bin\x64\AussieRelease\Odyssey.Windows.Controls.dll.
Done building project "DiagnosticImagingAssistant.csproj" -- FAILED.
any suggestions appreciated.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
modified on Monday, June 2, 2008 12:14 AM
|
|
|
|
|
Hi Christian,
I've never done any 64 bit stuff - but found these on the MSDN forums if they're any help.
Clickety[^]
Clickety[^]
Dave
|
|
|
|
|
Just found this[^] one too which may be of more help in step 3.
Dave
|
|
|
|
|
Hello everyone,
I am new to Reflection. Two basic questions about Reflection after some tests.
1.
About BindingFlags.Instance, I think it should refer to all entities which are not static but instance level, but I have made some tests and found it is not correct.
What does BindingFlags.Instance mean?
2.
What is the differences between FieldInfo and FieldType classes? In what situation should we use FieldInfo and in what situation should we use FieldType?
thanks in advance,
George
|
|
|
|
|
George_George wrote: I have made some tests and found it is not correct
Post your code.
|
|
|
|
|
Thanks PIEBALDconsult,
Here is my code to test the Instance status,
class Program
{
class Foo
{
static int abc;
int bcd;
}
static void Main(string[] args)
{
Foo f = new Foo();
FieldInfo[] fields = f.GetType().GetFields(BindingFlags.Instance);
return;
}
}
regards,
George
|
|
|
|
|
Try making the fields public and adding (ORing) System.Reflection.BindingFlags.Public
|
|
|
|
|
Thanks PIEBALDconsult,
I have tried when adding both Public and BindingFlags.Public, the non-static field bcd can be retieved. But why using Instance tag alone is not working?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace TestReflection1
{
class Program
{
class Foo
{
public static int abc;
public int bcd;
}
static void Main(string[] args)
{
Foo f = new Foo();
FieldInfo[] fields = f.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public);
return;
}
}
}
regards,
George
|
|
|
|
|
George_George wrote: But why using Instance tag alone is not working?
Reading the documentation[^], in the remarks section it says:If the requested filed [sic] is non-public and the caller does not have ReflectionPermission to reflect non-public objects outside the current assembly, this method returns nullNothingnullptra null reference (Nothing in Visual Basic). From your original example[^], your fields are implicitly declared as private.
You need to either make the fields public or adding BindingFlags.NonPublic.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Thanks Scott,
1.
Scott Dorman wrote: have ReflectionPermission to reflect non-public objects
Means using BindingFlags.NonPublic to grant permission?
2.
I am confused what means "outside the current assembly" and why it applies to my situaion, since I am always using the same assembly -- the current.
Any comments?
regards,
George
|
|
|
|
|
George_George wrote: Means using BindingFlags.NonPublic to grant permission?
No, permission is different and is part of Code Access Security (CAS), which is an entirely different topic. To grant permission you would need to add a ReflectionPermission attribute to the code somewhere (not sure where since I don't know the code you are using and don't do a lot with CAS and reflection.
George_George wrote: I am confused what means "outside the current assembly" and why it applies to my situaion, since I am always using the same assembly -- the current.
"Outside the current assembly" means just that - the calling code is located in a different physical assembly than the code being called. This may not be the case.
What it comes down to is that you really should think of the binding flags like a combination of this:
1. BindingFlags.Instance or BindingFlags.Static
2. BindingFlags.Public or BindingFlags.NonPublic or ... (any of the other flags)
By just specifying BindingFlags.Instance you are effectively saying get me any instance field that is neither public nor non-public, which really doesn't leave a lot.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Thanks Scott!
1.
"By just specifying BindingFlags.Instance you are effectively saying get me any instance field that is neither public nor non-public" -- where do you find this point? From MSDN I can not find out. Could you post a link about where you find the statemen please? I want to learn more.
2.
I think CAS does not apply to my sample, and also "Outside the current assembly" also does not applies to my sample. Correct?
(please refer to my code in my original very first question post)
3.
What members are neither public nor non-public? Interested to know.
regards,
George
|
|
|
|
|
George_George wrote: By just specifying BindingFlags.Instance you are effectively saying get me any instance field that is neither public nor non-public" -- where do you find this point? From MSDN I can not find out. Could you post a link about where you find the statemen please? I want to learn more.
There really isn't a direct link for this. It comes from reading the MSDN documentation (more correctly, reading "between the lines") and experience.
George_George wrote: I think CAS does not apply to my sample, and also "Outside the current assembly" also does not applies to my sample. Correct?
Correct. From your other post, CAS doesn't really apply; nor does "outside the current assembly".
George_George wrote: What members are neither public nor non-public? Interested to know.
There really aren't any. (That's why I had the ). Access modifiers can be broken down like this:
Public, meaning is "access not limited".
Protected, meaning "access limited to the containing class or types derived from the containing class".
Internal, meaning "access limited to this program".
Protected internal (which is protected or internal), meaning "access limited to this program or types derived from the containing class".
Private, meaning "access limited to the containing type".
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Great Scott!
1.
Scott Dorman wrote: There really isn't a direct link for this. It comes from reading the MSDN documentation (more correctly, reading "between the lines") and experience.
That's fine. Could you post the link please so that I can also have a learn?
2.
Could I understand "internal" is used to restrict access only to the current assembly (e.g. other assembly can not reference this "internal" type)?
regards,
George
|
|
|
|
|
George_George wrote: Could you post the link please so that I can also have a learn?
Sure, the link is: http://msdn.microsoft.com/en-us/library/6ztex2dc.aspx[^]
George_George wrote: Could I understand "internal" is used to restrict access only to the current assembly (e.g. other assembly can not reference this "internal" type)?
Yes, internal restricts access to only the current assembly.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines][ Articles][ Blog]
|
|
|
|
|
Great Scott!
What means "When overridden in a derived class, searches for the fields defined for the current Type" in the document? I am especially confused about what means "overridden in a derived class" and "defined for the current Type". Could you show me some pseudo code please?
regards,
George
|
|
|
|