|
Which version of .NET is installed on the user's machine and which version are you developing with/for?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I am using the .NET framework SDK 1.1! On the user machine was installed .NET framework Redistributable (dotnetfx.exe), downloaded from the microsoft.com download center! The error message is:
Header - Common Language Runtime Debugging Service
Application has generated an exception that could not be handled.
Proces id=.... i wrote this (every time different)
Click OK to terminate the application.
Click CANCEL to debug the application.
I had captured that form and here is a link to that file (error message that i`m keep getting):
http://img478.imageshack.us/img478/9673/dx9proba8ir.png
Thanx!
|
|
|
|
|
The message itself doesn't tell you much - just that an exception has been thrown very early into your program.
Since all the .NET redistributables are called dotnetfx.exe, you can't tell the version just from the filename.
Look at C:\Windows (or C:\WinNT) on the user's machine. You must have a subdirectory Microsoft.NET\Framework\v1.1.4322. If you do, then you can be pretty sure .NET 1.1 is installed.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
I had a similar issue with different cultures and performance counters. Disable them if you are using them and see if thats the issue.
|
|
|
|
|
How can i prevent my form from freezing when doing a large fucntion.
For instance:
I read a 20,000 line file line by line.
after each line i do something with the data.
This could take a long time. So i would use a progress bar to show progress.
The progress bar starts but after a couple of seconds the progress bar does not move and the form freezes up until the process is finished.
How can i prevent this from happening.
Do i use another Thread?
|
|
|
|
|
Yes. Using another thread will fix the problem. In .Net 2.0 you can use the backgroundworker class, which seems to be an improvement over the Thread class.
|
|
|
|
|
If you use a worker thread, make sure you don't try to update your progress bar directly from that thread; invoke a delegate method for updating your progress bar instead.
--
I've killed again, haven't I?
|
|
|
|
|
However, if you are using .Net 2.0 the background worker class has a progress updated event handler in which you can update your progress bar.
|
|
|
|
|
I've run into this before. I ended up using creating a single delegate function called ThreadEvent which does everything and derived my own class called ThreadEventArgs from EventArgs to handle communicating what the thread is reporting.
Here's my delegate that handles whenever the thread sends any signal:
private void ThreadEventDelegate (object sender, ThreadEventArgs e)<br />
if (<control>.InvokeRequired)<br />
{<br />
this.BeginInvoke(new ThreadEvent (ThreadEventDelegate), new Object[] { sender, e });<br />
}<br />
else<br />
{<br />
<handle the event properly here><br />
}<br />
This is needed because the thread cannot change a control. What this does is it asks the control what unique thread number it is under. Whatever current thread is running is compared and if they are the same, then it doesn't need to invoke and it's safe to change the control. If they are different, the thread calls BeginInvoke to execute a new delegate asynchronously with the same data it was passed inside the thread it should have been.
|
|
|
|
|
I am currently using VS 2003 Professional and I am looking to see if anyone knows if MS added a RS232 Serial Comm class to VS2005?
|
|
|
|
|
|
Thanks. I will take a look.
|
|
|
|
|
Hi guys.I am actually working on a project which plot a graph and then show different values of graph in a datagrid.Can anybody help me with some hints how can I grab this points from graph and show them on datagrid?
Best regards.
|
|
|
|
|
If your application plots the graph from a function, then you could just evaluate the function f(x) at x to get the function's value and put those in the datagrid.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I have written a C# DLL that I intend to call from an unmanaged C++ app. I have so far followed all the rules that Microsoft explains in this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkcominteroppart2cservertutorial.asp[^]. My ultimate goal is to have a method in the C# DLL which will populate a string OUT parameter, and call it from C++. Something like void GetErrorString( int iErrorCode, ref string szErrorString ) . Now do not take that signature seriously - because that is what the question is! What should be the signature???? And how exactly do I call it from C++?
So far I have tried:
Attempt 1.
C# signature:
void Func2( int iCode, ref char [] szOut );
C++ call:
char szRetString[ 128 ];<br />
cpi->Func2( 10, &szRetString );
Result: Runtime error
Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result.
Variation: Instead of "ref" in C#, tried without ref. Same result.
Attempt 2.
C# signature:
void Func2( int iCode, ref string szOut );
C++ call:
char szRetString[ 128 ];<br />
cpi->Func2( 10, &szRetString );
Result: Runtime error
Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result.
Variation: Instead of "ref" in C#, tried without ref. Same result.
Attempt 3.
C# signature:
void Func2( int iCode, ref StringBuilder szOut );
C++ call:
char szRetString[ 128 ];<br />
cpi->Func2( 10, &szRetString );
Result: Runtime error
Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result.
Variation: Instead of "ref" in C#, tried without ref. Same result.
And all the cross-variations of the above combinations as well!!!!
Can somebody please tell me where am I going wrong? My C++ project does not have UNICODE defined. But please note that I have succeeded in calling the example provided by the MSDN article (link above) - which means I am successful in sending a read - only copy of string as IN parameter into C#.
Ever wondered that microsoft examples avoid the harder part?;)
Koushik Biswas
If you would not be forgotten as soon as you are dead...
either write things worth reading or do things worth writing.
|
|
|
|
|
Strings are immutable in C#, so "ref string" might not mean much, since the target would still be unchangeable. Also strings in c# are by definition Unicode, so you will likely need to define UNICODE in your c++ project. C# strings map reasonably well to BSTRs from an interop point of view. You might try making the C++ signature "Func2(10, &BSTRmystr) and match that with the stringbuilder variant odf the C# one...
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Hello,
Let's say I have a function, exp^x for example. I would like to draw a graph
of this function in the client area of my form.
The only way I can think of doing this is to write a conditional loop that
will iterate through values of x within some interval and then draw the value onto the screen scaled in some way to the clientRect.Height and clientRect.Width.
Question: What do I have to do to get the 'graph' to appear as one continuous smooth plot?
thanks
|
|
|
|
|
Create a Point for every x/y coordinate you have, put them all into an array and then call:
Graphics g = e.Graphics;
Point[] points = CalculatePoints();
g.DrawLines(Pens.Black, points);
You can also play around with the SmoothingMode property of the Graphics class. This will probably help you to make it look 'nicer'.
|
|
|
|
|
Hi, I have an application where users can do many find/replace operations, including regexes. The problem is that if the user wants to replace something with a carriage return/newline and enter \r\n it literally replaces with "\r\n", however if I try the same thing but in the code, and specify a regex to replace something with \r\n it does replace with a carriage return/newline.
Otherwise the regex works properly, for example the user can find a carriage return/newline with \r\n and they can replace with $1 for example, but it just doesn't work when you try and replace with \r\n .
thanks for any help!
|
|
|
|
|
If the user types this into the textbox it's like you would define the string like the following:
string s = @"\r\n";
or
string s = "\\r\\n";
You could replace it manually within your code:
string s = s.Replace(@"\r, "\r).Replace(@"\n", "\n");
|
|
|
|
|
|
Hi All
I have created a custom component which is just a gradient filled background. It all works well until resized as only the new area is redrawn.
How can I call repaint so that the entire component is redrawn instead of being invalidated?
Thanks
Nick James
|
|
|
|
|
Two methods:
1. Override OnResize and call Invalidate() (without parameters).
2. Put base.SetStyle(ControlStyles.ResizeRedraw, true); into your constructor.
Don't call Refresh() . It could reduce performance.
|
|
|
|
|
Thanks Robert, that worked a treat.
I knew there should be a one line answer. I've never looked at the ControlStyles objects until now.
I added the following lines:
<br />
base.SetStyle(ControlStyles.ResizeRedraw, true);<br />
this.SetStyle(ControlStyles.DoubleBuffer, true);<br />
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);<br />
this.SetStyle(ControlStyles.UserPaint, true);
So now I have double buffering with no flickering when the user resizes the control.
Once again thanks, and thanks to the Code Project for an excellent site.
|
|
|
|
|
Hi all !
How is the future of C#.net ?
is there any source ?
thanx !
s_mostafa_h
|
|
|
|