|
Hi
I'd like to invoke member function e.g. from System.Windows.Forms.Button. I found some article in MSDN for System.Int32 that works well but for class Button no :/
Type myType1 = Type.GetType("System.Int32"); // OK
Console.WriteLine("The 'Fullname' is {0} ",myType1.FullName);
Type myType2 = Type.GetType("System.Windows.Forms.Button",true); // ERROR ? WHY ?
Console.WriteLine("The 'Fullname' is {0} ", myType2.FullName);
myType2.InvokeMember(....);
Is possible in this case ?
Wizard_01
|
|
|
|
|
From MSDN docu:
"If typeName includes only the name of the Type, this method searches in the calling object's assembly, then in the mscorlib.dll assembly. If typeName is fully qualified with the partial or complete assembly name, this method searches in the specified assembly."
Since you're only specifing the type name, it looks in your assembly, can't find it then looks in mscorlib. System.Int32 is defined there but System.Windows.Forms.Button isn't. Thus the error.
This however, will work:
Type myType2 = Type.GetType("System.Windows.Forms.Button,"+Assembly.LoadWithPartialName("System.Windows.Forms").FullName,true);
or the much simpler
Type myType2 = typeof(System.Windows.Forms.Button);
|
|
|
|
|
Thank you
Could you tell me who can I now create new Object from 'myType2' ?
Wizard_01
|
|
|
|
|
Activator.CreateInstance(myType2);
|
|
|
|
|
Has anyone got sample code of using Oracle and .NET?
I'm specifically looking for the syntax of calling a stored proc and receiving a result set.
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
oracle has recently released a beta version of their managed data provider. It comes with fairly extensive help files.
You may want to look into using that instead of the OleDb data provider.
|
|
|
|
|
I'm looking at the site now.
Any idea if there's truth to the rumor that Oracle can't return a recordset from a stored proc. to ADO?
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
Hi All,
I'm having a small problem with my C# application.
I have a DLL written a while ago, using pure Windows API. Now, it would be really nice if I could call functions of that DLL from my C# application.
Any ideas how I might go about it?
Any help would be appreciated.
Regards,
Venet.
--------
Black holes are where God divided by zero.(Steven Wright)
|
|
|
|
|
i'm not an expert in dll-including, but i once took a function out of an ordinary dll like this:
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
and just used it.
that was all
:wq
|
|
|
|
|
Your best bet...
Put up the function call and we'll translate it for you.
It's incredibly easy with C# now. I've done about 20 of them so far and I'm really impressed with the robustness of them.
|
|
|
|
|
Thanks for your replies.
Basically the function contained within the dll is:
bool state;
bool InstallMHook(state);
And I have exported this function from mhook.dll.
So is this what I need to do:
[DllImport("mhook.dll")]
private static extern bool InstallMHook(bool someState);
as suggested by Rüpel ?
Regards,
Venet.
--------
Black holes are where God divided by zero.(Steven Wright)
|
|
|
|
|
|
I shall try this.
Regards,
Venet.
--------
Black holes are where God divided by zero.(Steven Wright)
|
|
|
|
|
Does anybody know how and if it is possible to access VS.Net Webforms designer using add-in and change some html code generated by each webcontrol.
For example i want to replace some html codes before it is displayed inside VS.Net.
Alper
|
|
|
|
|
In office about dialog, we can display a systeminformation dialog by click the button, how to do in C#?
I'm amumu, and you?
|
|
|
|
|
System.Diagnostics.Process.Start("winmsd");
|
|
|
|
|
Got it, thank you
I'm amumu, and you?
|
|
|
|
|
I am trying to create a custom web control in C#. As i know, i can provide own property for user to set their prefer properties. Example:
public string Text
{
get{ return text;}
set{ text = value;}
}
But, the case is, i want to allow user to set multiple values for a property where user click on the the property window, it will be popping up a window and add the properties by using my own window setting. Is this possible to do and where can i find some example on this?
Thank you in advance
|
|
|
|
|
|
I am having problems finding out how to convert a time from a client's local time zone to GMT/UTC.
It seems the classes I should use would be in the .NET SDK for either System.TimeZone or System.Datetime. However, the .NET Framework SDK's System.TimeZone object does not have a public constructor (and is abstract) and the System.DateTime only creates its CurrentLocalTime according to the server the code is running on.
So, how do I create and specify another timezone? Most of the examples I have found either use JavaScript to display the value in the client's system time or use the standard offset for the client's timezone (which usually does not take into account Daylight Standard Time and the varying dates that the timezone switches to Daylight Time).
Any help is greatly appreciated. Thanks!
Chris
|
|
|
|
|
|
Hi...
so what is it this time
This time I really would like someone, to explain how I store (and retrieve) bitmaps in a resource file....
Also: If I have a funktion to wich I want to send parameters, then how can I make a list appear, with the few diferant parameters I expect...
F.x.
call SomeMethod(Jump)// So when I want to send the paramet a list shows up with 5 differant options
private void SomeMethod(xxx usrAktion)
switch (usrAktion)
case Jump: etc;
case Walk: etc;
Please help, I will be greatful (honest)....
|
|
|
|
|
I'll help with the 2nd question:
If the parameter is of different types you can overload the method, just declare the same method with all the different paramaters.
If thats not really what you want your best bet is to use an enumerated type like so:
public enum UsrActions
{
Walk,
Run,
Jump,
Skip
}
And your method
private void SomeMethod(UsrActions usrAction)
{
switch(usrAction)
{
case UsrActions.Jump:...
case UsrActions.Walk:...
...
}
}
Then when using the method if you're in Visual Studio you get to this point
someObject.SomeMethod(
Intellisense will pop-up with letting you know its expecting a type UsrAction, just type UsrAction. and up pops the list of UsrAction s to choose from.
|
|
|
|
|
Well thanks.... I was guessing it was something like that...
Well once more: Thanks...
Also I would like to say sorry for the long response time.... My internet has been down >
|
|
|
|
|
I have created a simple client/server remoting interface that basically allows the client to get a byte array from the server. I am wanting to develop something that will allow the main thread on the server to initialize a byte array and allow the client to access this byte array from the interface. Does anyone have experience doing such a thing? Below is an example of what I want to do; but, don't know how to make it work. Look for initialization and How do I do this within the code comments.
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using RemoteInterfacecls; //Code not proviced at this time
using System.Runtime.Serialization;
namespace RemotingInterfaceServer
{
public class dataStuff
{
public byte [] mystuff;
}
public class EntryPoint
{
public static void Main(string[] args)
{
dataStuff dS = new dataStuff();
//Here is the initializaton
ds.mystuff = System.Text.Encoding.ASCII.GetBytes("This is a test");
TcpServerChannel channel = new TcpServerChannel(2566);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemoteExample),
"RemoteExample", WellKnownObjectMode.SingleCall);
System.Console.WriteLine("Hit Key to Exit");
System.Console.ReadLine();
}
}
public class RemoteExample : MarshalByRefObject, IRemoteExample
{
public RemotingExample()
{
Console.WriteLine("Constructor Called ");
}
public IByteArray GetByteArray()
{
ByteArray byteArray;
//This is the from the main initialization
// How do I do this ???????????
byteArray.bytesRead = mystuff;
return (IByteArray)byteArray;
}
}
[Serializable]
public class ByteArray : MarshalByRefObject, IByteArray
{
public byte [] bytesRead;
}
Tom McDaniel
|
|
|
|