|
Hi,
myTimer.Tick+=new EventHandler(t_Tick);
myTimer.Tick+=myFirstHandler;
myTimer.Tick+=mySecondHandler;
...
myTimer.Tick+=myTenthHandler;
teknolog123 wrote: the timer will increase the price and time every x minutes,
and that is why it ticks at 100 msec intervals??
teknolog123 wrote: When I use intervals like x minutes, It doesn't update the form right away
So you did something wrong in the implementation. That's no reason to alter your design.
I'll stick with a single timer, and have it run every 1 or 10 seconds or so. And I'd make sure all the forms show up-to-date information all the time.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Luc Pattyn wrote: see no problem in running 50 timers at once
This could be a huge problem depending on what operating system.
Terminal server 2000 will lock up (even with 1 timer you get that chance)
Terminal server 2003 will maybe lock up
All the rest are ok tho (haven't tested it with TS 2008)
|
|
|
|
|
I'm not familiar with Terminal Server, I only consider serious operating systems such as Windows XP and Windows Vista (I'll probably add Windows Seven to the list next year).
Obviously all functionality in the end would be limited by some system metric (available CPU power, memory size, disk size, bus bandwidth, etc.); and some by deliberate restrictions...
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Luc Pattyn wrote: serious operating
and
Luc Pattyn wrote: Windows Vista
in 1 sentence, that's got to be a first
|
|
|
|
|
I ran a 100-timer test on Vista before I replied.
I developed my text differ and wrote my mean-and-lean article on Vista.
For the last two years I basically do 99% of my work on Vista.
Over 90% of the software I was using on XP before, ran fine on Vista right away.
Even software that dates back from the nineties runs fine on Vista.
IMO most of the Vista bashing is undeserved.
I am aware there are some issues; there were some when XP was launched too.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
|
Tom Deketelaere wrote: Damn you go to extreme lengths
I do know how to use a loop.
And yes I test before I reply when I'm not quite sure.
(The most extreme I once did was downloading and installing a Fortran compiler in order to answer a simple Fortran question around here; I hadn't used the language in some 20 years, and never on a PC; but hey it worked very well on a PC!)
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Is there any reason why you aren't just reacting to events (e.g. the user opening the browser or loging in into the PC) and just recording the time the events are raised?
IMO (and I'm prepared to be flamed on this) doing This will have a far smaller impact on performance over continually polling and, if you implement it correctly, you'll get an audit log of who was on which machine and when (useful where there is an Internet connection ....). This will make the cost calcualtion a little harder if, for example you have different rates at different times, but it shouldn't be too bad. As for taking breaks etc, you can add functionality stop/ & restart times just associate these with one user session.
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
I agree. Events exist to avoid polling, resulting in better performance.
The OP probably also wants some real-time display of connection time, cost, whatever, so some kind of timer would still be required.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
well, the only reason of course is this is my first project.I am now googling the handler issue trying to sort it out.If I can't get the logic, I'm sorry I will get back to you
|
|
|
|
|
I have an ocx written in C++. It has one method like:
VARIANT_BOOL MyMethod([in, out] VARIANT* param1, [in, out] BSTR* strError);
Now I want to call this method from C# and get the values.
Currently I have tried calling the method as:
object obj = new object();
string strErr = string.Empty;
myObj.MyMethod(ref obj, ref strErr);
but this gives me an error saying the object is not a variant array.
Can someone please suggest what would be the proper thing to do. Can VariantWrapper class help me in achieving this. If affirmative, how?
Any pointers would be helpful and thanks beforehand.
|
|
|
|
|
Your best bet I would think, if it's an OCX, is to import it ( that means it's a COM object, right ). Then you will get a wrapper class generated for you.
The alternative is to go to www.pinvoke.net[^] and look for examples there, unless someone other than me can give a more definitive answer.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
you can't marshal a VARIANT, it isn't even supported by the CLR.
The only thing you could do is prototype it as an IntPtr (and ignore it, as you don't have any other method that can digest it).
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I think you should marshal VARIANT type as System.IntPtr and next use Marshal.GetObjectForNativeVariant to convert it to valid CLR object.
[EDIT]
You could also write your own custom marshaler to provide for automatic marshaling from native to managed objects and back.See this MS sample.
Life is a stage and we are all actors!
modified on Thursday, September 24, 2009 7:10 AM
|
|
|
|
|
I use the following code to operate my treeview asynchronously.
IAsyncResult result = sourceTree.BeginInvoke(l_CreateTreeNodes, new object[] { sourcenode.Nodes[stables],destinationnode.Nodes[dtables],mSourceInfo.TableNames,mDestinationInfo.TableNames});
While(!result.IsCompleted){}
But asynchronous operation is not completed and 'result.IsCompleted" property is always 'false'.
So, the operation isn't existed from while loop.
I don't know why 'IsCompleted' property is always false.
|
|
|
|
|
If you need blocking calls, why to use BeginInvoke ? Use Invoke instead. It is synchronous and waits until the message is processed.
|
|
|
|
|
Not that it matters, but why {} rather than ; ?
|
|
|
|
|
Hi, I am running this code:
<br />
string fullFilename = "\\\\server\\share\\DL_JP_462153474_461535959_attest.JPG.pdf";<br />
byte[] bytes = File.ReadAllBytes(fullFilename);
and get this exception:
FileNotFoundException
"Could not find file '\\\\server\\share\\DL_JP_462153474_461535959_attest.JPG.pdf'."
The only problem is that the file does actually exist! Also, it works on files with shorter filenames in the same folder. For example:
\\\\server\\share\\DL_JP_448856461_461530268_462153469.pdf
Does anyone know what this is all about?
|
|
|
|
|
It's *highly unlikely* that System.IO.File is wrong, but more likey that the path provided is incorrect in some way.
try replacing this:
string fullFilename = "\\\\server\\share\\DL_JP_462153474_461535959_attest.JPG.pdf";
with this
string fullFilename = @"\\server\share\DL_JP_462153474_461535959_attest.JPG.pdf";
If you use the string with the @ symbol rather than your escaped version, you can copy the contents of the string you set fullFilename and perform some manual checks( such as pasting the path\\server\share\DL_JP_462153474_461535959_attest.JPG.pdf into explorer).
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
So that is what the @ is for
Thank you for your answer, but I have to admit that I screwed up, and the file actually doesn't exist
I am working with some testdata, and someone placed an error there (possibly on purpose?)
That is a lot of hours wasted...
the difference_:
DL_JP_462153474_461535959_attest.JPG.pdf
DL_JP_462143474_461535959_attest.JPG.pdf
|
|
|
|
|
Thomas ST wrote: That is a lot of hours wasted...
We've all done this sort of thing!
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
Good day
I am trying to serialize/deserialize a class (for the first time), and the serialization works fine, but as soon as I try to deserialize it, it gives me the exception:
System.Reflection.TargetInvocationException was unhandled
Message="Exception has been thrown by the target of an invocation."
Source="mscorlib"
InnerException: System.Runtime.Serialization.SerializationException
Message="Member '' was not found."
Source="mscorlib"
at Trainer.BoostedClassifier..ctor(SerializationInfo info, StreamingContext context)
The class I'm serializing contains a List<int> type, could this be the source of the error?
I would appreciate any ideas to what this exception might be hinting at. (let me know if more info is needed)
tvb
|
|
|
|
|
Sorry, I forgot to mention why my heading is called serializing an inherited class;
My class I am serializing also contains a list of my own object type (List<Object>), but the objects themselves are inherited instantiations.
In other words, I'm serializing:
MainClass <-- being serialized. Which contains,
List<Object> <-- where an the objects are of type,
InhertiedObj : Object
If that makes any sense?
I would post the code, but it is unfortunately very long.
tvb
|
|
|
|
|
Hi
Is it possible to create a word document without using third party libraries and the interop object in c
# programatically??
modified on Thursday, September 24, 2009 5:02 AM
|
|
|
|
|