|
vinaykskvs,
Repost[^]
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
Maybe he deleted all his code
|
|
|
|
|
I'm sure I saw a very similar question not so long ago, and it got replies too! So I hope your not the same person.
Anyway, a Graphics object has the method DrawCurve which takes a Pen and a PointF[] as parameters, so you can probably use that.
PointF[] myPoints;
...
void MainFormPaint(object sender, PaintEventArgs e)
{
e.Graphics.DrawCurve(Pens.Black, myPoints);
}
EDIT: Wow, so many replies in a few moments! And you are the same person, for shame.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
I'm using datagrid in a web page, i want to add new records in the database using this grid, can I?
Thanks for help
|
|
|
|
|
|
hi,
i'm trying to write a compact file sharing application- server side and client.
client connect to the server given port and ip (for searching files)and at the same time listening on a different port to other clients trying to connect (file transfering requests).
while connected to the server and listening for incoming clients requests he can connect to other clients (for receiving files).
i have problem testing this application on my computer:
after connecting to server and starting to listen, when the client trying to create a new TcpClient connection object i get the TcpClient Exception:"The requested address is not valid in its context"
thanks in advance
yohay
modified on Thursday, June 5, 2008 8:29 AM
|
|
|
|
|
This usually results from an attempt to bind a listening socket to an IP address that's not valid for the local machine.
Are you using 127.0.0.1 as your ip address in the client (on the local machine)?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
yes..(or tcpClient=new TcpClient("localhost", 9355);)
|
|
|
|
|
Hi,
I'm new to C# and am having an issue understanding how to easily handle something that should be straightforward.
That is, I have an array of a fixed length. At each iteration a new double is added to the array and the oldest is to be removed. How do I do this, and re-index all of the other elements in the array accordingly, without rebuilding the entire array each time?
Regards,
Dave
|
|
|
|
|
DwR wrote: the oldest is to be removed.
How do you keep track what is the oldest?
|
|
|
|
|
New values are time dependant. So, the first entry in the array is always the oldest.
Regards,
Dave
|
|
|
|
|
A queue will be best here, refer to Ashfield's reply.
|
|
|
|
|
|
int i=0;
try // you can try if there is an array index and catch it if you are going out of your array bound
{
for(i=0;i<doublearray.legnth;i++)>
{
//it replaces the next index with the current index
doubleArray[i]=doubleArray[i+1];
}
}
// if you call doubleArray[doubleArray.Legnth], actully you have called an out of bound index, so you have made an exception and you can solve it with a try-catch statement
catch
{
//now your newValue is replace as doubleArray[doubleArray.Legnth-1]
doubleArray[i]=newValue;
}
|
|
|
|
|
Sajjad Izadi wrote: for(i=0;i
{
//it replaces the next index with the current index
doubleArray[i]=doubleArray[i+1];
}
Urgh!
It definitely isn't definatley
|
|
|
|
|
Is it just me or is this a REALLY bad idea - deliberatley causing an exception to be thrown?
Throwing an exception in an object is acceptable if a value passed is outside acceptable limts or whatever (although it's normally better to revert to a defalut value and raise an event), but deliberately causing an exception? Yuck!
Dave
|
|
|
|
|
DaveyM69 wrote: Is it just me or is this a REALLY bad idea - deliberatley causing an exception to be thrown?
No, It is not just you. I think it is bad design to use exceptions to handle the "normal and expected" flow of execution. When exceptions where first added to the C++, I started seeing code like:
open file;
try
{
loop forever:
read line from file;
}
catch
{
}
It not usually a good idea to use exceptions to manage the normal flow of execution for a couple of reasons. First, exceptions are expensive to handle so you will almost certainly degrade performance. Also, sprinkling try statements all over the place makes code difficult to read. Conceptually, the whole point of an "exception" is to indicate an exceptional condition (i.e. Out-of-memory) that cannot be easily handled at the time/place the error condition is reached. The whole idea of an exception should be to pass control of the program to a place that can handle the error condition.
If you are using exceptions in lieu proper bounds checking or verifying the return value of a method or API call, then, in reality, exceptions are just a high-tech way of implementing a GOTO which can leave your system in an undefined state. These are generalizations and "exception-neutral programming" outlines acceptable techniques for the best use of exceptions (See Exceptional C++, Herb Sutter).
|
|
|
|
|
thanks friends. i didn't know them.
there are always better ways that i offer .
|
|
|
|
|
You can use a cyclic buffer by keeping a start index pointing to the first item in the array. When adding an item you just advance the start index to shift all items in the array.
You can wrap it in a generic class, something like this:
public class CyclicArray<T> {
private T[] _data;
private int _start;
public CyclicArray(int size){ _data = new T[size]; _start = -1;}
public int Length { get { return _data.Length; } }
public T this[int index] { get { return _data[(index + _start) % _data.Length]; } }
public void Add(T item) { _start++; this[-1] = item;}
}
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Why don't you use a generic list? When you add a new item, simply remove the 0th one.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Now that would not be very efficient! But it will work
|
|
|
|
|
leppie wrote: Now that would not be very efficient! But it will work
All the good answers were taken.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
HAHAHA
|
|
|
|
|
There is no need to rebuild an array each time.U do one thing u take stringbuilder class's object and use it. Which will allow you to take an array of any length.
Bhumika
|
|
|
|
|
Hi,
I'm during numerical calculations here. The array is comprised of doubles and not strings.
Regards,
Dave
|
|
|
|