|
No, there is no limit I am aware of, and a quick test says that you can use more than 3852 points anyway:
Point[] points = new Point[4096];
public frmTesting()
{
InitializeComponent();
Random r = new Random();
for (int i = 0; i < points.Length; i++)
{
points[i] = new Point(r.Next(0, 200), r.Next(0, 200));
}
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
Pen p = Pens.Red;
e.Graphics.DrawLines(p, points);
}
Works with no problems. I would suspect the problem is in your other code.
BTW: You shouldn't create a new Pen like that - you are responsible for calling Dispose on all graphics elements you create, so you should keep a reference to it, or use a stock item as I did.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
The only limits I know of are the size of the array you're passing. It must be less than 2GB of data and be less than Int32.MaxValue (2.147 billion) elements long.
|
|
|
|
|
I received a C# 2008 console application from a contract shop to work with. The purpose of the console application is to consume data it receives from a web service. (The contract shop that wrote the web service also wrote the console application I am suppose to work with.)
My questions are the following:
1. The console application writes to a log file. The only results I can see that can come from the log file is a dos window that displays while the application is running. If this is true, can you tell me how to have the log file write to a different location?
2. When I run the console application, I sometimes see error messages that show up in the dos popup window. At first I thought the error messages came from the web service. However today I opened up an *.xsd file and I see alot of the error messages that appeared in the dos window the last few days. Thus can you tell me how to determine how the *.xsd file is wired to the application? I would like to learn how the code is called.
3. Can I step through the code that is executed from the *.xsd file? If so, how would I accomplish this task? Do I need certain debug options set?
|
|
|
|
|
|
1. I'd guess they are using TraceListeners[^]. The one you're probaly after is the TextWriterTraceListener[^]. The link has a code snippet on how to implement the TextWriterTraceListener to help get started. The first link shows how to setup a listener declaratively using the config file. This is the better way to go because you can control your listeners without recompiling the application.
2. Don't know
"You get that on the big jobs."
|
|
|
|
|
dcof wrote: I received a C# 2008 console application from a contract shop to work with
Meaning you got the executable or the code?
dcof wrote: can you tell me how to have the log file write to a different location?
That depends on how they are logging.
However you can run an app using the following which MIGHT work. There must NOT be a space between the 2 and >.
MyApp 2>ErrorFile.txt >Output.txt
dcof wrote: Thus can you tell me how to determine how the *.xsd file is wired to the application? I would like to learn how the code is called.
Obviously looking at the code would tell you.
dcof wrote: Can I step through the code that is executed from the *.xsd file?
No. You can step through the code of the application though.
|
|
|
|
|
I’m using Visual Studio 2008 and I started a Window’s Form project in C++.
I want to switch it over to C#. I realize that I will have to basically re-write the operational code, and the functionality behind the forms, but what I want to do if I can is "import" the form designs to C#.
I’m only interested in the placement of the boxes and buttons etc., not the coding that links one form to the next or the operational code behind each button.
Is there an easy way to copy / import the forms from C++ to C#?
|
|
|
|
|
Since it is a Windows Forms CPP project, it's easy:
Go to the C++ form in design mode.
Press CTRL+A, CTRL+C
Go to the C# form.
Press CTRL+V
Voilà!
(If it missed anything, it will be custom controls, that you need to manually add the using statements for before you paste)
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Thanks for the reply Griff.
Your response was 99.9% correct!
The only thing missing was that I had to make sure that the base form (the tiny one that Visual Studio creates) was enlarged large enough to hold all that the CTRL+V was going to paste into the form.
Once I did that, everything tansferred perfectly.
Thanks again -- huge help
|
|
|
|
|
I can't think of everything!
You're welcome!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Umm Hi,
This is a question related to yesterdays "Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly....." I have found an oddity with the data I am reading in at odd times I get "\n" appearing (it's serial data) I am using a foreach() loop to split up the data coming in with one one the delimiters being "\n" I'm guessing that as there are two next to each other it see one kills it and lets the other pass,
Resulting in a blank line. If I use
if (subString == "\n")
break;
with out effect
I have got it so it creates the a save file as
Quote: 8/30/2012 3:51:21 PM| LD:0002=H10003027710004940129142|
8/30/2012 3:51:21 PM||
8/30/2012 3:51:21 PM| LD:0003=H2000749724900011250077140|
What I need to do is stop the above line appearing in the save function.
The foreach to assemble the string is
foreach (string subString in Unit_Reply.Split(delimeter))
{
if (subString == "\n")
break;
if (subString.Contains("\n")||subString.Contains("\r"))
{
MessageBox.Show("ALERT!!!");
}
Unit_Reply_Modded += "\n" + dt.ToString() + "|" + subString + "|";
}
the commented out lines have been tried and found not to work (also the if Contains does nothing), I was trying to avoid using the StreamReader / Writer and BinaryReader /Writer as I am a little of how they work also I am attempting to read data from a board I read in the past with out using them.
|
|
|
|
|
If delimeter is a char[] with one of the delimiters being the '\n' character, then all you need to add is an optional parameter to the String.Split method:
glennPattonWork wrote: foreach (string subString in Unit_Reply.Split(delimeter, StringSplitOptions.RemoveEmptyEntries))
StringSplitOptions.RemoveEmptyEntries will remove emtpy entries from the resulting String[] which will occurr if there are two (or possibly more) consecutive '\n' characters in your string.
Regards,
— Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
|
You're welcome!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Ignore lines with Length == 0?
|
|
|
|
|
How could I have missed that!
Have a five.
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Mmmm.... will it ignore all lines with no printable text?
|
|
|
|
|
|
Well thats what I wanted, not to worry though got it working(ish) that's no longer a problem, Manfreds method worked like a charm now I'm fighting ReadExisting()!!!
Glenn (roll on 5:00 pm )
|
|
|
|
|
In a C# 2010 application, I want to place files in dynamic folder structures that I create in the application. I want to create these dynamic locations so we can place data in the dynamic paths based upon customer name. I also wantto place these dynamic paths in the app.config file.
Thus can you tell me if there is a way to point the app.config file to these dynamic paths? If so can you tell me and/or point me to a reference I can use that will help me accomplish this goal?
|
|
|
|
|
|
Hi jschell,
Any updates to the config file itself will boot off the user using the site as on saving the file, IIS will try to reload that information, in effect ending all user sesisons. I think it would be a better idea to store this information in an application object which can later on be accessed. Let me know if I was wrong or misunderstood your point.
Thanks and Regards,
Thanks and Regards,
Aby
|
|
|
|
|
I make asked to come up with directory paths that look like the followiing:
C://08-30-2012/Customer 1
C://08-30-2012/customer 2
C://08-31-2012/ customer 1
C://08-31-2012/customer 3.
If you can not change the app.config file, how would you change to come up directory path names like I am just displaying?
|
|
|
|
|
Well, the first thing I see there is that you aren't basing the directory structure off the customer name. You are basing it off the date first, so your example doesn't match your stated requirements. Which one is right?
You don't actually need to complicate things like this - all you need to do is create a common root path for the customer data, and then put the customers under that root path. For instance:
c:\App Customers\Customer 1\08-30-2012
c:\App Customers\Customer 1\08-31-2012
c:\App Customers\Customer 2\08-30-2012
c:\App Customers\Customer 3\08-31-2012
Then you can just look for the appropriate customer path. Add yourself a little SQLLITE database and you can store the base path in there, along with any other dynamic information you need.
|
|
|
|
|
That's web.config, not app.config. App.config typically goes with desktop applications.
|
|
|
|