|
Lol no worries. The attribute trick might be worth it, although with reflection you can get the name of an enum constant (of course these are subject to C# naming rules). That library looks interesting. Thanks to both of you for the responses.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
I want to drag and drop custom control on the form this control had been inherited from using System.Windows.Forms.UserControl
hint:
1) an object of this control will be created at runtime by reflection then will be added to the form collection(System.Windows.Forms.Form.Controls).
2) the form_MouseClick EventHandler is used to create the control on the form
My problem
how can i get a certin control from the(System.Windows.Forms.Form.Controls),then handel its events of drag and drop ?
|
|
|
|
|
Hello,
I have an application made in asp with an SQL Database not published to the Web.I want to make another application via ASP.net that use the same database and post it to the server. (I think i have to post also these database)
Do the .net Remoting can allow to me accessing these database without posting it to the server.(costing of database hosting is very expensive).
Best Regards.
dghdfghdfghdfghdgh
|
|
|
|
|
I think you have a couple options. Either use SQL Express or SQL CE on the server (which are free), or host the database yourself and connect to it from your server.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
I have made my own control inherited from System.Windows.Forms.UserControl
then by using reflection I have created an object from my own control at run time
after creation this control have been added to the collection of the container(form)
System.Windows.Forms.Form.Controls.
the problem is
When the control is in the form (before runtime) it's easy to handel any of its events but now how to handel this control's events as (MouseDown , MouseUp , DragDrop , DragEnter and DragOver) as this control has never been created yet ?
|
|
|
|
|
So, somewhere in your code you have something like this:
YourControl control = Activator.CreateInstance<yourcontrol>(...);
this.Controls.Add(control);</yourcontrol>
You have to associate the events after creating the object, before the control variable goes out of scope:
YourControl control = Activator.CreateInstance<yourcontrol>(...);
this.Controls.Add(control);
control.MouseDown += ... ;
control.MouseUp += ... ;
</yourcontrol>
After writing += press tab and visual studio completes it for you.
However if the you are trying to do something internal to the YourControl class, you should encapsulate the behavior in the class, associating the events in the constructor.
Cheers,
rotter
|
|
|
|
|
Write the event handler beforehand, so you have something like this in your code:
public void ControlEventHandler(object sender, EventArgs args)
{
}
and repeat this also for the mouse/drag event handlers. Next, when you create your control at runtime, simply assign these event handlers, like that:
Control ctl = new Button();
ctl.Click += new EventHandler(ControlEventHandler);
this.Controls.Add(ctl);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I drop ifelse activity to workflow, but i see a red exclamation mark that tell me "Executes contained activities based on condition specified".i don't know where write my condition.please help me.
|
|
|
|
|
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi,
How can I reach database relation diagram of sql by using smo? I want to learn parent key table of any column if that column is foreign key.
Forexample, in northwind database, in products table, there is categoryid column. This column is related to id in Category table. I want to find this.
Best Regards
THANKS
|
|
|
|
|
Hi friends,
How can I use Windows keyboard api to press some keyboar keys without using keyboard? I want to press some of keyboard keys by clicking button?
If you give sample code or link, I will be very glad?
Best Regard
Thanks
modified on Monday, August 25, 2008 9:26 AM
|
|
|
|
|
|
|
Check out the Win32 SendInput()[^] function. I wrote an article[^] that demos how to use it for spoofing mouse clicks--keyboard input would be similar.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
|
Hello everyone,
From ServiceController class, we can easily get the names of all the services on the current system. My question is how to get the physical absolute path of the executable file for the service? I found quite a while in MSDN, but failed.
thanks in advance,
George
|
|
|
|
|
The Win32_Process Management class (WMI) contains the absolute path of the executable. If you know the process ID, you can query that class to retrieve the absolute path (referred to as the "ExecutablePath").
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks John,
I have the ServiceController object instance related to the service, do you know how to get the process ID from the ServiceController object instance?
regards,
George
|
|
|
|
|
Not offhand. Have you tried google?
It looks like the ProcessID is the same as the Handle, so you could use the Handle property in the Win32_Process class.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi John,
Do you mean the PathName other than the ExecutablePath? I have tried and all the ExecutablePath of all services are null, but PathName contains the full path, PathName contains parameter as well.
regards,
George
|
|
|
|
|
It's "ExecutablePath". This is not part of the ServiceController object, it's something else completely. Google "WMI", or search on Codeproject - there are articles.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
Did you read my first response at all? I'm talking about the Win32_Process class.
I suppose you can use the Win32_Service class if you want to.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks John,
My mistake before. Now I have found it.
regards,
George
|
|
|
|
|
Helllo,
Can somebody know how to add a tooltip in the controlbox of a Form while it was contained in a Parent MDI
best regards,
dghdfghdfghdfghdgh
|
|
|
|