|
Hi Chris
I guess that by doing this you want to get the same values from the original object to a new object
and change its property.
well, all that says on the preveius nodes are correct.
but if i understend you correctly then to implement what you need is
you should create a contractore for your object "AnimatedSprite " which
get the values as you want
like:(in the AnimatedSprite Class)
public AnimatedSprite (string currentAnimation,string property2, string property3....)
{
this.CurrentAnimation=currentAnimation;
this.Property1= property1;
this.Property2= property2;
}
then in your Generate function
asMySprite = new AnimatedSprite(newCurrentAnimation,asfOrigin.prop2,asfOrigin.prop3);
this way you create a new instance of AnimatedSprite with the values that you want
Guy
|
|
|
|
|
Hi Everybody,
The List Objects in Excel 2003 grow row-wise automatically as and when a user enters some value in the row next to the last list row.
Is there any way to limit this behaviour of the list object.
Hope to hear from you people at the earliest,
Thanks in Advance,
Karthick
|
|
|
|
|
Hello...
I don't want to load my application more than once. That's why, I'm using GetProcessesByName.
If length of process array more than 1, that means exit, if only 1, then OK.
But someone told me that I must use Singleton.
What do you mean about that ? Is Singleton the right way ?
|
|
|
|
|
|
hi.
how i can include dotnet framework in my project setup application?
thanks.
|
|
|
|
|
|
Hello,
how can I safely call a method from another thread? For instance, a method that belongs to a progressbar control on my form, from a backgroundworker thread.
I've tried using events, lock, volatile but nothing worked. I always get the InvalidOperationException (Cross-thread operation not valid).
I am trying to execute the PerformStep() method of the progress bar on the main form every time a certain progress is made in the backgroundworker.
It's quite weird that I solved a similar problem with updating the status bar on the main form by using events, but that was made by assinging a string to the .Text property. Seems like in a cross-thread operation, changing properties is ok, but calling a method is not.
I know there's another way to report progress with backgroundworker, namely via the Backgroundworker.ProgressChanged event, but my question is somewhat more general: how to call a method from another thread safely?
Thanks,
Michal
|
|
|
|
|
You can use the Invoke method of the control to safely execute a method on the control's thread. Generally it is not safe to do any GUI control manipulation on a non-GUI thread, you need to marshall those calls across to the GUI thread using Invoke.
--------------------------------------------------
|
|
|
|
|
Thank you very much!
Invoke() method and one delegate solved the problem.
It's great there are people like you who are willing to help.
Thanks,
Michal
|
|
|
|
|
I just have 2 questions :
1. how to override a api function ? (i mean the technique)
2.how to do that if i use c#
Please help me !
Thanks
hoang van tien
|
|
|
|
|
hoangvantien wrote: 1. how to override a api function ?
To be able to do this, the class containing the function you're interested in must have 2 requirements: the class cannot be sealed, and the function must be virtual.
If both of those conditions are met, you can inherit a class from the class containing the function you're interested in, then override the method in that class.
public class ClassYouAreInterestedIn
{
public virtual void DoSomething() { ... }
}
public class MyOverride : ClassYouAreInterestedIn
{
public override DoSomething() { ... }
}
|
|
|
|
|
As API is a quite broad term (and often abused), the answer may well depend on the context of your API:
1) If API is a C API or like, there will be no overriding, as overriding only applies to OO programming. Function overloading will make sense in this case. But see 2).
2) If API is a library you load via Platform Invoke, you could only override the invoked method in your C# wrapper, not the original one. Thus, there will be no direct overriding.
3) If API is a .NET assembly (DLL), lets say, written in managed C++, you can extend the base class and override its methods if the class is derivable, thanks to the cross-language compatibility of .Net Framework.
4) If...
Best,
Jun
|
|
|
|
|
I am searching for a customized treeview control which has the following functionalities:
1) Word wrap for the nodes.. since i want to avoid the horizontal bars
2) For scrolling i am using two buttons.. but i m not able to bind the button click event with the scroll event of the treeview control
3) Set background image for the treeview and also set images for each node.
I m using VS 2005 and .NET framework 2.0
If anybody has developed such control, kindly send me the source code.
Any help will be appreciated
Thanks
A.K
|
|
|
|
|
Try entering TreeList or TreeView into the search bar for the CodeProject there are a couple of articles here which may do what you want, but then again may not.
As of how to accomplish this I have no idea, have you tried Google? Faiing that try
|
|
|
|
|
Hi
Can anyone tell me how to bind vertical Scroll event of treeview control with the VScrollBar scroll event?
Thanks in advance
A.K
|
|
|
|
|
What is the best way to manage the deletion of master records that have child records? I load the data from the database into a dataset. I would like to give the users the following functionality: If a user selects a number of records to be deleted and some of them have child records, I would like to give the user the option of either skipping those with child records or deleting them (including their child records).
I am using Visual Studio 2003 and C#.
Thanks.
Kobus
|
|
|
|
|
I would suggest doing this in the database via a stored procedure. No doubt there is quite a bit of opinion on this but may I suggest using logical deletes and not actually removing the records until a later time. I tend to use a bit field as a logical delete then during a schedlued window do the physical deletes.
|
|
|
|
|
Hi,
Can anyone let me know how to declare a local const in a method
using CodeDOM? I am trying to get an output that looks like this:
public void SomeMethod()
{
const int MyInteger = 56;
}
One workaround is to use a CodeSnippetExpression and output the literal
"const" keyword. But that'll make it specific to C#. I prefer to keep
the output language option flexible.
Thanks in advance for your help.
-Venkat
|
|
|
|
|
I'm pretty sure you won't be able to do this. Not every .NET language has the ability to declare constants inside a method. You'll have to stick to putting it inside the class.
Logifusion[ ^]
If not entertaining, write your Congressman.
|
|
|
|
|
Hi guys
i have a service that suppose to connect to data base and process
when faild to process i want to stop it.
when i stop the service by the ServiceController
it pop up a message "...service on local computer started and then stopped, some services stop automaticly..."
and if i dont stop the service then its status stays as started...
how can i stop the service without getting these message
here is my code:
public void StartMethod(object stateInfo)
{
try
{
CacheDataManager.InsertItemsToCache();
}
catch(Exception ex)
{
this.EventLog.WriteEntry(ex.Message.ToString(), EventLogEntryType.Error);
this.Dispose();
ServiceController myService = new ServiceController(this.ServiceName);
myService.Stop();
}
protected override void OnStop()
{
try
{
CacheDataManager.ClearItemsInCache();
}
catch
{
this.EventLog.WriteEntry("The service has stopped", EventLogEntryType.Warning);
}
}
the service is working fine when process succeded.
please help me with that , i spend 2 days for looking a solution
Thanks in advanced
Guy
-- modified at 6:06 Thursday 7th September, 2006
|
|
|
|
|
Have you checked the system event log? It might have some more information about your specific error. It could be that your service is terminating automatically on startup.
--------------------------------------------------
|
|
|
|
|
no
it is start and process fine
but i want it to be stop if the process that he should do is fails
like when he cant connect to DataBase.
i'm catching the Exeption and set the service to be stop
while doing that i get the message on Services window.
i dont want do get this message when stopping the service from its code.
|
|
|
|
|
I still think it would be a good idea to check the event log for any additional info. Also you could check the CanStop property of the service controller before doing stop.
As a last ditch attempt you could just throw an exception without handling it. This should terminate the service!
--------------------------------------------------
|
|
|
|
|
i've checked the event log and its just give in formatin about service states
it look ok since its stop after i press ok on the services window message.
i added the code for checking if service can stop and still get the message
try
{
CacheDataManager.InsertItemsToCache();
}
catch(Exception ex)
{
this.EventLog.WriteEntry(ex.Message.ToString(), EventLogEntryType.Error);
this.Dispose();
ServiceController myService = new ServiceController(this.ServiceName);
if(myService.CanStop)
{
myService.Stop();
}
if i throw exceptin without handling, then its just stays as "started"
running it in debug mode "myService.CanStop" set to true
well it is doing the stop but popuping the message as well
any idia how to make these pop up message not show ?
the message is "The <myservice> service on local computer started and then stopped, some services stop automatically if they have no work to do, for example, the performance logs and alerts service"
-- modified at 7:34 Thursday 7th September, 2006
|
|
|
|
|
Hi all.
I have a simple question that I just can't get right.
When you create your deployment project, you set the version of your installer in the properties.
Now my question being is in my code, how can I retrieve that version number, the one you would assign to your own app?
I googled and searched and only version that I found to retrieve was the framework version, and that I don't need.
I'm sure it must only be a very simple statement....
Thanks in advance
He who laughs last is a bit on the slow side
|
|
|
|