|
delay of time = 1msec? nvm
u can use timer:
public System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Interval = 1;
aTimer.Enabled = true;
aTimer.Elapsed += new ElapsedEventHandler(OnTime);
public void OnTime(object source, ElapsedEventArgs e)
{
//... do something
}
|
|
|
|
|
System.Threading.Thread.Sleep(1);
|
|
|
|
|
There is no way you can count on a 1 msec delay, it's just not going to happen. That's the lowest value you can set on a timer, it's always going to be more than that.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
As Christian said, the delay you get from a timer will exceed 1 msec, no matter what you ask
for. (If you ask for small values, you probably will get around 10 to 16 msec). This holds
true for Form.Timer, Threading.Timer and Timers.Timer
There are ways to obtain shorter delays, e.g. by using a multimedia timer.
I have just finished an article on this, I expect it to appear in the coming days.
Title will be "Timer surprises...".
Luc Pattyn
|
|
|
|
|
Using C# in VS.NET 2003, I included the system.windows.forms namespace but i can't find the HTMLElement. It should be available. How come?
Any suggestion pls?
|
|
|
|
|
I think this class is only available in Dot Net 2.0 (VS 2005).
|
|
|
|
|
That means i have to buy a new version If so then this is terrible . Is there something else i can do?
|
|
|
|
|
You could try to use the XmlDocument / XmlElement objects - but that gave me a lot of trouble.
Or you could just use the Express version
|
|
|
|
|
|
Hi
Can anybody help me with the code how to loop a windows forms datagrid using c#
Regards,
Sivaprasad
|
|
|
|
|
hi friends,
do any one of you have any idea about returning more than a single value from a function.
if so, do favour me by sending some sample codes as early as possible
Thanks
Suresh.C
|
|
|
|
|
Use collection object
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
You could use output parameters.
eg
private bool SomeFunction(string inParameter, out string outParm)
{
outParm = "someValue";
return true;
}
|
|
|
|
|
You could also create a struct which encapsulates all the the members you would like to return. The function would return an object of the structure type.
|
|
|
|
|
I always prefer this approach when output is not also an input.
|
|
|
|
|
sukaan wrote: do any one of you have any idea about returning more than a single value from a function.
The preferred option is to create a class to hold the values that you wish to return.
sukaan wrote: if so, do favour me by sending some sample codes as early as possible
class MethodResult
{
public int SomeInteger;
public string SomeString;
}
class SomeClass
{
public MethodResult SomeMethod()
{
MethodResult result = new MethodResult();
result.SomeInteger = someLocalIntegerValue;
result.SomeString = someLocalStringValue;
return result;
}
}
|
|
|
|
|
In summary, you can use (in decreasing 'quality' order):
1 returning one reference value (say an instance of class myResults) holding all the results
this is the preferred way, certainly if lots of results need to be made available
2 returning a small struct
small here means no more than 8 bytes (e.g.2 ints)
3 one ref or out parameter holding a struct
this avoids the creation of the myResults instance
4 returning a large struct
this causes a lot of data moving around when there are many results to report
5 out or ref parameters each holding a simple variable
this gets clumsy and cumbersome very soon
6 public class members in the class that contains your method, so you can obtain
whatever subresult you may need
not structured, not thread-safe, the complete opposite of modern OO techniques
So I suggest you try and stick to 1, 2 and 3.
Luc Pattyn
|
|
|
|
|
I always like reading your summary!
First of all because it's always well structured and of corse correct!
But also because you are not using specialized english words which are difficult to understand (for me at least)!
Thanks!
|
|
|
|
|
My code is,
AxMSChart20Lib.AxMSChart chart = new AxMSChart20Lib.AxMSChart();
chart.Title.Text = "My first chart";
this.Controls.Add(chart);
When i use this code, i get this exception,
"InvalidActiveXSateException was unhandled"
Exception of type:
'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.
Can u tell, how can this be corrected?
Thanks for your time and patience-Guna
|
|
|
|
|
Hi can anyone help me create a simple calculator using asp.net web form with C# language. Or if anyone could help me locate one
thankyou.
|
|
|
|
|
Smells like homework. What have you done already ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
thanks for the help, reallly appreciate it.
|
|
|
|
|
I am looking for an interactive diagram component for WinForms. If you have seen or used Corgent Diagrams then thats what I need. Corgent Diagrams is really neat but really expensive too.
What I need is the ability to create diagrams in design time then load the diagram into a Winforms application and then let the user double click or right click different parts/shapes/connectors in the diagram to select various menu options. So imagine a flowchart created in design time. When a user right clicks on a certain shape I want to be able to handle the event and present the user with a menu based on the shape. Imagine loading a visio file into your application and then wiring all events on all shapes to some code. Does anyone know of such a library or component?
Thanks.
|
|
|
|
|
Ok, I'm having a few problems with designer in Visual Studio...
I have a MainToolbar class which has buttons on it (e.g. Forward, Back). The buttons are private but they're exposed publicly via various Properties, e.g. ForwardShown, ForwardEnabled. These properties have 3 Attributes...
[Browsable(true), Category("Icons Visible"), DefaultValue(true)]
Now I place the MainToolbar on a Form called FormBaseEdit and it works well.
The value for the properties like ForwardShown is true and NOT bold (as it should be). The MainToolbar is a protected member of FormBaseEdit.
The problem comes when I then inherit from FormBaseEdit.
The properties of the MainToolbar is still true However they are now BOLD. IF you change them to false they are not bold. Then when you build the project the properties that you changed to false are automatically back to true.
Does anyone know how to stop this?
Thanks,
Chris McGrath
|
|
|
|