|
Vous obtiendrez une réponse plus rapide si vous utilisez l'anglais.
Thank heavens for google translate.
CCC solved so far: 2 (including a Hard One!)
|
|
|
|
|
Here's a 5 just for making the effort to translate it.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
Vous pourriez avoir plus de chance demandant aux auteurs de ces contrôles dans leur forum de support comme la plupart des gens ici n'ont pas travaillé avec ces contrôles.
|
|
|
|
|
Parlez-vous de contrôle d'élaborer sur mesure?
Il n'ya rien comme combo multi-colonnes en. NET.
|
|
|
|
|
MultiColumnCombo est un contrôle de la bibliothèque janus.
|
|
|
|
|
Hi, I'm currently working on a cyber cafe program and I need to use 2 timers for each table's calculations and there are 25 tables(pc's).The question is, does using many timers(with 100ms intervals) have any impact on the performance?
And referring to 2 timers, there are two different calculations(time and price)which occur at different intervals.Is it possible to handle them in one timer?
last question(sorry ) Is it good to make all controls and variables public to access from other forms?
Your help would be appreciated,thanks
|
|
|
|
|
I can answer the last, and probably the second of those.
teknolog123 wrote: two different calculations(time and price)which occur at different intervals.Is it possible to handle them in one timer?
Only if the two intervals happen at multiples of each other. If one is due at 100ms and the other at 123ms intervals, then you cannot handle them both easily from the same timer. If one is due ate 100ms and the other at 500ms intervals, then yes, just count 5 instances of the timer event.
teknolog123 wrote: Is it good to make all controls and variables public to access from other forms?
No. This is very bad practice as it locks the design of your form, and you cannot change it without making changes in an unknown number of other forms. Use public properties instead, as the underlying form elements are hidden and can be changed without affecting external code.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
I already use public properties for variables but have no idea what would be the best way to access another form's controls without compromising performance.Any idea?
thanks
|
|
|
|
|
It is really not a good idea to directly access the controls on another form: If you later change from say 5 text boxes to a single listview, then how many other forms are dependant on that code? You have find and modify all of those. Instead, use public methods and properties - I wouldn't worry to much about any performance hit, it is cheaper to upgrade the PC than to waste programmer time fixing problems you create with bad design in the first place!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi,
I see no problem in running 50 timers at once. (I tested with Windows.Forms.Timers)
If all intervals are 100 msec, then:
1) your average handler should finish in 2 milliseconds, otherwise your app will accumulate a delay;
2) I see no reason to have separate timers, as they will all tick at the same time;
Anyway:
1) I would avoid running that many timers; it tells me something is wrong in your design; I would start by using one timer for everything, and add many handlers to it.
2) It seems to me you are polling something, rather than relying on events. What is it that you are testing in the tick handler?
3) why would you need a 100 msec interval? are you charging customers for connection time up to a fraction of a second???
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Luc Pattyn wrote: 1) I would avoid running that many timers; it tells me something is wrong in your design; I would start by using one timer for everything, and add many handlers to it.
Could you please give me an example of adding handler to a timer?
Luc Pattyn wrote: 2) It seems to me you are polling something, rather than relying on events. What is it that you are testing in the tick handler?
Basicly the timer will increase the price and time every x minutes, that's it(all pc's will increase at the same interval even if some pc's are off and some are on)
Luc Pattyn wrote: 3) why would you need a 100 msec interval? are you charging customers for connection time up to a fraction of a second???
No I am not that miser. There are times that I give customers extra plus or minus minutes for delays/breaks. And of course this action requires changes on the time and price.When I use intervals like x minutes, It doesn't update the form right away
|
|
|
|
|
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
|
|
|
|