|
Tom Thorp wrote: If we limit ourselves to what MONO supports, I think this may be a solution.
Search for threads about in on the Lounge. MONO has some fairly large sized holes in the base classes. MONO also uses GTK.net for graphics instead of trying to port winforms (too win32 centric in design). Even if none of the former are a problem for you, if a *nix port is in your likely future you'd probably do better writing the UI with GTK.net now instead of having to rewrite it later.
--
You have to explain to them [VB coders] what you mean by "typed". their first response is likely to be something like, "Of course my code is typed. Do you think i magically project it onto the screen with the power of my mind?" --- John Simmons / outlaw programmer
|
|
|
|
|
Christian Graus wrote: C++ is obviously going to be faster.
Not necessarily true, depends heavily on the implementer.
|
|
|
|
|
Hi Tom,
I understand your doubts; we had the same doubts more than ten years ago, when
we considered switching embedded system programming to Java; Java has a similar
garbage collection approach. But we did switch over, and soon we were glad we did
because of the increased programmer efficiency and code robustness.
The garbage collection concept is quite OK if you pay some attention to it.
Of course you must (continue to) care about the number of objects you create; every object
sooner or later must be retrieved to recycle the memory it was occupying.
Switching an image processing application from C++ to C# should not be seen as an
open invitation to turn every pixel into an object...
Here are some examples that limit the object generation rate:
1. when performing complex string operations (say a number of concatenations),
you will be better of using a StringBuilder.
2. short-lived objects, large or small, that only consume a limited number of CPU
cycles in their life span, need special attention, to avoid the gc effort becoming
noticeable. If you currently manage these objects yourself,
you can continue to do this, by recycling them, rather than letting them fade away.
I do not recommend you do this all the time, but when applied to a few classes at
the heart of your application domain, it may prove quite useful.
Of course these examples may seem like giving in on the advantages of C#, but that
would be true only partially and locally. It is similar to general performance optimisation:
in order to improve overall app performance, one must look for hot spots and then give in
a bit to gain some (or a lot).
Hope this may be helpful.
|
|
|
|
|
Hi All,
I have developed a windows application using serialport.
I am able to send the data to the terminal but not receiving it..
here is my code
SerialPort port = new SerialPort("COM4", 9600, Parity.None, 8, StopBits.One);
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
port.DtrEnable = true;
port.Handshake = Handshake.RequestToSend;
txtData.Text = txtData.Text + port.ReadExisting();
}
Why i'm not able to receive data? whats wrong in my code... Could anyone please help me on this issue...
Thanks in Advance/..
|
|
|
|
|
write instead of your code like this code.
use:
create a delegate like this:
private delegate void Update();
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
port.DtrEnable = true;
port.Handshake = Handshake.RequestToSend;
this.invoke(new invoker Update(this.refresh));
}
private void refresh()
{
txtData.Text = txtData.Text + port.ReadExisting();
}
|
|
|
|
|
sorry this code was wrong:
write this:
private delegate void Updatedatas();
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
port.DtrEnable = true;
port.Handshake = Handshake.RequestToSend;
this.invoke(new Updatedatas(this.refresh));
}
private void refresh()
{
txtData.Text = txtData.Text + port.ReadExisting();
}
|
|
|
|
|
Hi, Thanks for your help..
but, still it isn't receiving any thing..
could anyone plz help me to resolve this issue....
-- modified at 7:03 Wednesday 27th June, 2007
|
|
|
|
|
I think you have to set the RtsEnable flag.
port.RtsEnable = true;
try it out
|
|
|
|
|
Hi,
this is my 4-step advise to you:
1.
first make sure you dont get anything in your app: try to read one byte (a raw byte,
not a char, not a string) and show it on the Console (this avoids all GUI trouble,
crossthread problems, etc).
2.
if that fails make sure there is something to receive on the serial cable:
try another program, such as hyperterminal. As long as that does not receive anything,
check your cable, your port settings, your target device; if necessary, use
an oscilloscope or whatever to debug the hardware/firmware.
3.
Once hyperterminal shows something reasonable, return to your app.
Again I recommend reading bytes (a byte array) rather than ReadExisting()
until you start getting data, since I expect that has better chance of delevering
something (it avoids Encoding problems and the like). Check your handshaking;
and try a different one.
4.
When things are getting alive, now start reading chars and/or strings.
Remark: in another thread I got the impression serial port was NOT using ASCII encoding
by default, it seemed to be using Unicode instead.
Good hunting !
|
|
|
|
|
What do you want to pay, for somebody doing your homework?
|
|
|
|
|
i will give him 50% discount
so what is your offer ??
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
You shouldn't dump the prices here on the forum!
You destroy the marked, and then one day we have to help people for free here!
|
|
|
|
|
Martin# wrote: and then one day we have to help people for free here
man not today , i need some cash
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Hi,
Can anyone of u suggest different types of containers present in c#.The containers should have a capability of withholding images,text.... and should be capable of exporting these images when required.
so pls list out all possible containers
-- modified at 2:26 Thursday 28th June, 2007
srujana
|
|
|
|
|
hi,
The richtextbox is not a container control. It renders rtf formatted text into pictures etc.
The controls that derive from ContainerControl are container controls!
Check MSDN or Reflector for containercontrol.
Gideon
|
|
|
|
|
i try to control serialport with C#.i use laptop and USB-RS232 changer.nowadays i see window's blue error screen than my laptop close.why i see this error?how can i block this?how can i correct it?
|
|
|
|
|
hi
i create an application that use crystal report for reports
when i test application in a computer that have .net has no problem, but when i run my application that has not .net (visual studio) show follow exception :
crystaldecisions.crystalreports.engine
how can correct this problem?
tanks
|
|
|
|
|
How to Create a DLL Library using C# ? The DLL be called by the C/COBOL (legacy language )?
|
|
|
|
|
I have posted this before, but now I have some more information. Many thanks to those who tried to help 1st time.
I have a windows form with a rapidly updating chart, and I want to use double buffering to prevent flicker. Without double buffering my app runs OK (apart from the flickering). With double buffering it starts up OK, but when I load the double buffered form the following occurs:-
The form loads then runs the paint method:-
private void Diagnostics_Paint(object sender, PaintEventArgs e)
{
Graphics ChartGraphics = e.Graphics;
ChartGraphics.DrawImage(DiagChart.Image, DiagChart.OutLine.Left, DiagChart.OutLine.Top);
ChartGraphics.Dispose();
if(Started)
StaticBtn.Enabled = false;
}
Then it runs:-
Application.Run(new SC226());
which causes an ArgumentException "Parameter is not valid". SC226 is my application, so shouldn't this line only run when the application is launched? If I comment out the first 3 lines of the paint method it doesn't run the "Application.Run" line and I don't get the exception(but my chart doesn't draw). Can anyone help please?
|
|
|
|
|
Do you catch any exceptions somewhere that shut down your application and then restart it? There's no way a class in the System.Drawing namespace would call Application.Run().
|
|
|
|
|
Eduard Keilholz wrote: Do you catch any exceptions somewhere that shut down your application and then restart it?
No there is nothing in my code that restarts the app.
|
|
|
|
|
Richard W Allen wrote: ChartGraphics.Dispose();
You shouldn't be disposing objects you didn't create by calling 'new' on them
|
|
|
|
|
leppie wrote: You shouldn't be disposing objects you didn't create by calling 'new' on them
right, especially if you add "... unless you obtained them from a method with Create in
its name, as in CreateGraphics".
|
|
|
|
|
leppie wrote: You shouldn't be disposing objects you didn't create by calling 'new' on them
Many many thanks - that did the trick!!
|
|
|
|
|
I'm new to C# and use VS Express 2005 and SQL Express 2005.
Question:
1. I have added Employee.mdf database via Project->Add new item->SQL database
2. Using the following, but see strange things:
SqlConnection sqlcon = new SqlConnection(connectionstring);
- If I use connectionstring as:
"Data Source=.\\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=true; User Instance=True"
I get error like: User domain/user passoword failed! No remote access etc strane errors
- If I use connectionstring as:
"Data Source=.\\SQLEXPRESS;AttachDbFilename=\"C:\\Documents and Settings\\user\\My Documents\\Visual Studio 2005\\Projects\\MyDatabase\\MyDatabase\\Employee.mdf\";Integrated Security=True;User Instance=True"
Then it works fine!
But in every book I see, they give the above 1st case but it does not work for me? Any idea? Is it fine to explicitly using the database path in C# project?
|
|
|
|