|
|
Ok, did an ~20s trial run.
Slowest lines of code were two where I called CSerialPort.Write(...) ~8s net. and the actual write to the stream in Write.
Slowest methods were:
Forms.UnsafeNativeMethods.WaitMessage() 18s
System.Threading.WaitHandle.WaitOne() 8s
UnsafeNativeMethods.* isn't listed in MSDN help.
Honestly, I don't see that I'm any closer to a resolution.
public void Write(byte[] buf)
{
try
{
m_MyStreamWriter.Write(buf);
m_MyStreamWriter.Flush();
}
catch (Exception e )
{
Console.WriteLine(e.ToString());
}
}
|
|
|
|
|
What I think I need is a way to do the write asyncronously, although that potentially opens up a whole new can of worms with multiple writes piling up over top of each other. Agregating multiple messages and sending them in a single chunk would be another option but I don't currently have access to the blackbox I'm interfacing against, nor do I have specs on its uart or how frequently it checks the buffer.
-- modified at 15:23 Monday 8th May, 2006
Something else that's occured to me, could my not having a null modem hooked up be causing the delay with windows trying and failing to send before giving up?
|
|
|
|
|
Hi PrjectCode Team Thank You For Your Successfull Site That Help Many Developers And Beginners To Develop Their Projects Really I'd like To Ask A Question That Question Is:
How Can I Load The SQL Server DataBases Into A Combo Box Using The ADO.Net And C# And Their Tables In Another One According To The Database That I'll Choose From The Combobox1 ?
Thank You For All Your Efforts
Night Attack
|
|
|
|
|
You Might Want To Break Your Question Down Into Specific Problems Or Issues You Are Having, Currently Your Question Is A Bit Garbled And Does Not Make Much Sense.
Also, We Tend To Reserve Upper Case First Characters For The Beginning Of A Sentence, A Person's Name Or A Place Name.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
hi all,
i have two forms one in my language and one in english. first i open the one in my language then i select english one from menustrip (language option).
but i want the first one to be closed when i open the second one.
and vice versa. (if english is open and i select the native one, i want english one to be closed.)
if i use Close(); when opening the second form, both forms are closed
how can i achieve my goal ?
help please,
bye.
|
|
|
|
|
Have you tried hiding the form instead of closing it? form_english.hide()?
|
|
|
|
|
From your post I assume that you've implemented the same form twice, just with different languages for the user interface. That isn't the best way to do it. .NET provides good support for globalization and lovalization of windows applications, which is very good covered on MSDN[^].
To change the lanuage of your user interface at runtime e.g. via the menustrip, take a look at my article: Change culture of user interface at runtime[^].
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Change your Program.cs file to this:
static class Program
{
public static ApplicationContext CurrentContext;
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
CurrentContext = new ApplicationContext(new Form1());
Application.Run(CurrentContext);
}
}
Then in your handler to close Form1 do this.
Form2 dlg = new Form2();
dlg.Show();
Program.CurrentContext.MainForm = dlg;
base.Close();
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
I'm developing a library, when I try to convert float to string, in case of a point it set a coma, what can I do about it?
|
|
|
|
|
A comma usually denotes a thousands seperator, at least in English numbering. For example, one might write 1000 as
1,000
Is this what you're trying to parse? Or is a comma truely in place of a decimal point, for example, instead of 1.5 it's 1,5?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Is Jesus the Jewish Messiah?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
That's exactly what's happening, but the coma are in the point place in one of my projects, not in others, I suspect is something related with my project language, any idea please?
|
|
|
|
|
Specify a fixed culture when converting the float to a string.
float x = (float) 0.6;
x.ToString(new CultureInfo("en-US")));
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Yes for sure, thats right, the point it's do that in a global level, (in my app domain) anyway was really helpfull you idea Troschutz, wolud you help on that too??? thnx & sorry for the inconvenience.
|
|
|
|
|
If no culture is specified, ToString and similar methods use the value of the CurrentCulture property of the current thread. So do:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Thnx, now I'm a mutch better Software engineer..
|
|
|
|
|
No, it gives "0?6" where "?" is replaced by whatever the user specified in regional settings for US English.
float x = (float) 0.6;<br />
x.ToString(new CultureInfo("en-US", false)));
gives "0.6" no matter what the regional settings are as you specifically istruct it to ignore any custimization made for the culture.
|
|
|
|
|
Hello Friends
I have a form with several controls on it,
Now I want to know on what control user clicks,
It means I want to show messagebox like this :
BRAVO! YOU CLICKED ON BUTTON1
I don't want to write a code in all cotrol's MouseDown event and i want to write it in form's mouse click event once.
Thank You
|
|
|
|
|
Won't work like you want because the Click event of the Form won't fire when a control on it is pressed. You could nevertheless write a recursive function to bind all events:
private void BindMouseDown(Control control) {
control.MouseDown += new MouseEventHandler(OnAnyControl_MouseDown);
foreach (Control subControl in controls.Controls)
BindMouseDown(subControl);
}
BindMouseDown(this);
The sender argument in your handler will then tell you which control was clicked.
|
|
|
|
|
Hello Dear Robert Rohde
Your code solved my problem and it was so cool.
Tank you very much
|
|
|
|
|
This is how we did it 20 years ago. Now, we use Windows messages. And, if you are doing it in C# (or VB.NET), it is even simpler: double-click the button1 control, and VS.NET generates an event handler for you, into which you put your code to display the message box.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
hi all,
i have a simple form with a label and button on it.
i want to print the labeltext when i click the button. but i dont know how to do it ?
would you please help me do this using c# ?
thanks in advance,
bye.
-- modified at 11:04 Monday 8th May, 2006
|
|
|
|
|
|
Hello.
I'm looking for information on to add / change wireless settings like SSID, Passphrase, and decrypt keys through C# .NET... is this possible?
The reason i'm asking is because i'm developing an simple application which can change specific network parameters like IP, DNS, etc. and i need to be able to add / change wireless connections too.
|
|
|
|
|
Hi,
How do I include the '<' character in a c# XML comment (///)?
What is the escape character?
ie.
/// ie. List<string> ......
won't work because <string> is interpreted as a xml element. but I just want to use the '<' and '>' as a comment.
Any help greatly appreciated. Thanks in advance
Pakl
|
|
|
|