nmaillet 97 Posting Whiz in Training

dir isn't actually an executable; it is a command that Command Prompt understands. You could replace line 4 with:

p.StartInfo.FileName = "cmd";
p.StartInfo.Arguments = "/c dir";

That should work for you.

nmaillet 97 Posting Whiz in Training

The DataSet class does offer direct serialization to/from XML files, however I'm assuming your DataSet doesn't necessarily correlate to your XML schema. So, take a look at the XmlDocument class. Basically you can create XML elements and attributes using the XmlDocument's Create...() methods, than use AppendChild() on the appropriate object to build its structure. Finally use XmlDocument.Save() to generate the file.

kvprajapati commented: Good suggestion. +15
nmaillet 97 Posting Whiz in Training

OK, so I thought I was on the C# forum with the last reply:yawn:. Check out The Apache POI Project. I've used it before and it's fairly painless.

nmaillet 97 Posting Whiz in Training

This is not working since using a literal backspace character will not remove characters from the string. You could check: if(c == '\b') and remove the last character. You will probably have issues if text is inserted in the middle of the text. I would suggest using a DocumentListener :

jTextField.getDocument().addDocumentListener(this);

Then implement a DocumentListener interface:

@Override
public void insertUpdate(DocumentEvent e) {
    System.out.println("insert");
}

@Override
public void removeUpdate(DocumentEvent e) {
    System.out.println("remove");
}

@Override
public void changedUpdate(DocumentEvent e) {
    System.out.println("changed");
}
mKorbel commented: correct suggestion +8
nmaillet 97 Posting Whiz in Training

You cannot have a Vector() and a Vector(...) constructor. Constructors with a variable number of parameters could have 0 parameters. Which is equivalent to Vector() . The compiler is uncertain of which constructor to call. You have to remove the parameter-less constructor and perform a check in the other constructor for the number of parameters passed. Hope that helps.

nmaillet 97 Posting Whiz in Training

Your using the OR operator when you should be using an AND operator. If you say bmires2 >= 18.50 || bmires2 <= 25.00 , it will always evaluate to true. Therefore the only thing that would affect the statement is age > 19 .

Just for instance, if bmires2 = 10.00 , then bmires2 >= 18.50 is false, but bmi <= 25.00 is true. Given this, true AND false will evaluate to true.

In my personal experience, whenever I am using a mixture of AND's and OR's, I use parentheses to avoid any confusion.

ddanbe commented: Good! +14
nmaillet 97 Posting Whiz in Training

The preprocessor directives are listed here:
http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx

The #pragma directive only supports warning suppression and ASP.NET file checksums. You can use the Debug class in System.Diagnostics to write to the Output window:
http://msdn.microsoft.com/en-us/library/6x31ezs1.aspx

Hope that helps.

nmaillet 97 Posting Whiz in Training

Strings are immutable objects. That is, whenever you make a "change" to a string, a new string is created, and you reference the new string.

To replace the last character:

oldmassiveoutput = oldmassiveoutput.Substring(0, oldmassiveoutput.Length - 1) + " ";
kvprajapati commented: Or.. System.Text.StringBuilder :) +15
nmaillet 97 Posting Whiz in Training

The Paint event is raised when the Form is first shown, this is to give the Form its initial appearance. When you show a Form it enters a message loop. Messages are sent from the Operating System. If you look at the Windows API, there are some flags that determine when the window should be redrawn (e.g. horizontal or vertical resize). The paint event can also be called from within the application. The form creates a Graphics object, filling it with the background colour of the form, then when the Paint event has finished calling all of the delegates it can use the Graphics object to write the pixels to the monitor.

Hope this helps to clarify things.

nmaillet 97 Posting Whiz in Training

Try str.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); .

serkan sendur commented: very good +3
nmaillet 97 Posting Whiz in Training

If my math is correct,

x(n) = x + r*cos(a + n*pass)
y(n) = y + r*sin(a + n*pass)

where 0 <= n < vertex , x and y is the center point, a is the angle of the first point to the right of the center point from the horizontal(counter-clockwise) and r is the distance from the center point to each of the vertices(the "radius"). Let me know if this is what you were looking for.

Alex_ commented: Good formulas! +1