|
Control.CanFocus is readonly. So I think this will not work.
|
|
|
|
|
I am creating a custom control that inherits the ComboBox class. I would like to use the ISite.DesignMode indicator to determine if the control is being viewed in design mode but the property always comes up false. MSDN documentation says the design mode indicator is stored in the ISite; therefore, if the Component does not have an ISite associated with it, this property is always false. Other things I have read said to assign the atribute to the class to designate which class to apply the ISite implementation but I have not seen any examples that put all the pieces together. Can anyone share with me this method or any other method that would allow me to determine when this custom control based on a combobox is in design mode?
Thanks,
Kyle
|
|
|
|
|
Does anybody know where i can get a trial version of C#?
|
|
|
|
|
The .NET Framework SDK is a free download +- 121MB from microsoft. You can use SharpDevelop as an IDE which is also free available
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
Or you can order the trial version from this site:
http://msdn.microsoft.com/vstudio/productinfo/trial.asp
Have fun.
|
|
|
|
|
how can i clear screen in console applications?
|
|
|
|
|
|
thanks jared , i though of that solution but i wanted to know if there is a built function do this job
anyway thanks for replying
|
|
|
|
|
1.I can add an assembly to cache, but I cannot find it in dialog when you click "Add reference", how can I let my assembly to the dialog's .net assembly list?
2.I built two version assembly(v1.0.0.0 and v1.0.0.1) that included the same sn, also added them to cache, now I want to refer the certain version of them in my application, how can I do?
I have tried "Add reference", but I cannot find it because the problem 1, then, I used "Browse" to select a certain version dll(ie: v1.0.0.0) file because of using the namespace of the shared assembly, then I wrote a config file of application:
bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.0.1"
But when I run the program, the application still link to v1.0.0.0.
Any thoughts?
Thank you!
I'm amumu, and you?
|
|
|
|
|
Feng Qin wrote:
1.I can add an assembly to cache, but I cannot find it in dialog when you click "Add reference", how can I let my assembly to the dialog's .net assembly list?
In the registry you will find a key where it lists all the directories it will search for. On my computer this is located at HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\AssemblyFolders . Just follow the pattern there and you'll be able to add your install folder to the list so that your assembly is listed in the "Add Reference" dialog.
If you don't want to modify the registry you can put the assembly in the %WINDIR%\Microsoft.NET\Framework\v1.0.3750\ directory and you should see it in the "Add Reference..." dialog. This is one of the directories that is specified in the registry in the above location.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thank you, James, but how about 2nd question?
I'm amumu, and you?
|
|
|
|
|
I've never used the binding redirect before so I can't really comment on how to get it working properly.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
I need to hook the keyboard messages system wide. This can be done by using SetWindowsHookEx() to do this.
HHOOK SetWindowsHookEx(int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId);
I got everything to work except the third param. What do I use for a handle if I want to do System wide hook?
Thanks for your time
|
|
|
|
|
This is not a C# question, but I'll answer anyway. Use 0 as the thread ID. Also, you will need to put your hook funcion in a DLL, so it can be loaded in every process.
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
Thanks for the information provided.
This is what I have right now:
public void StartHook()
{
int hookType = (int)NativeMethods.WH.KEYBOARD;
myHookProc = new NativeHookMethods.HookProc(this.hookProc);
hookHandle = NativeHookMethods.SetWindowsHookEx(hookType,
myHookProc, ??? ??, 0);
}
What do I put in the third parameter? Please help
|
|
|
|
|
|
Anybody can help me how can I implement C++ Copy Constructor in C# with a generic example.
Thanks in advance
|
|
|
|
|
You do it just like you would with C++; however the more correct method is to implement the ICloneable interface.
class Foo : ICloneable
{
public int bar;
public SomeClass baz;
public Foo()
{
bar = 0;
baz = new SomeClass();
}
public Foo(Foo sourceCopy)
{
bar = sourceCopy.bar;
baz = sourceCopy.baz;
}
public Foo Clone()
{
Foo f = new Foo();
f.bar = bar;
f.baz = new SomeClass();
return f;
}
object ICloneable.Clone()
{
return Clone();
}
} James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Thanks James you are always a good resource.
|
|
|
|
|
Hi,
I was wondering if the the Clone() method in the Foo class needs to be public. I've been using C# now for about 10 minutes,;P so please forgive me if this is a dumb question.
Thanks.
|
|
|
|
|
Its not a dumb question at all because the answer isn't obvious.
In the Foo class there are two different implementations of Clone(), one which is a member of the class and the other is Foo's implementation of ICloneable.
Interfaces in C# (and .NET) require that their members be public; so when I specifically implemented the Clone method as Foo's implementation of ICloneable I didn't need to specify the public access modifier.
In C# there are two different ways to implement an interface.
The first method is by adding a public member for each item in the interface you are implementing. Most people probably use this technique to implement an interface.
interface IBar
{
object Bar();
}
class Foo : IBar
{
....
public object Bar()
{
....
}
} The second method is to specify in the member's signature what interface it is implementing.
class Baz : IBar
{
...
object IBar.Bar()
{
....
}
} Unlike the first method the only way to use this member is cast the object to the interface (IBar ib = (IBar) myBaz; ). Now you can use the member as if it were any other interface.
This also gives an advantage for the users of your class. You can provide two different implementations of a member: one to be used when dealing with the interface, the other to be used when dealing with the class itself.
Most of the collections in the .NET class library do this to provide a strongly-typed collection while also implementing the generic interfaces that provide a standard way of using a collection.
Hope that answers your question
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
I am trying to read a custom config section but its not working. ConfigurationSetting.GetConfig() returns null;
CONFIG FILE:
<configuration>
<configSections>
<section name="data" type="System.Configuration.SingleTagSectionHandler"/>
</configSections>
<data Server="GODSWORKSTATION" Username="MedWizard" Password="MedWizard" Security="SSPI"
PersistSecurity="false" Pooling="false" MinPool="20" MaxPool="1000" NetworkLibrary="dbmssocn"/>
</configuration>
CODE:
IDictionary valueTable = (IDictionary)ConfigurationSettings.GetConfig("data");
string Server = (string)valueTable["Server"];
string Username = (string)valueTable["Username"];
string Password = (string)valueTable["Password"];
string Encrypt = (string)valueTable["Encrypt"];
string Security = (string)valueTable["Security"];
Any ideas? Thanks.
Steve
Not all who wander are lost...
|
|
|
|
|
You need to change the section line to specify the full assembly name (since the assembly has a strong name this means the typename, the assembly name, version, and public key token).
<section name="data" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
I have an article that's done but needs formatting and proofreading before I post it.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
|
Oops
it should have been configurationhandler not section
Correct link[^]
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|