Q:

Build Solution Problem

I am using Visual Studio 2010 with C#. 
When I use the Start Debugging tool (F5) everything seems to work fine.  So I build the solution. 
Now I close out of Visual Studio 2010 and go to the path where the 'application' is kept for the program.  When I double click on the file it runs the program fine.   However, when I go to click the "save" button in the GUI it saves the files but is being caught by my try/catch block. 
Why does this happen in the application when I double click it, but not when I am running Visual Studio 2010 to debug? 
EDIT:
try
{
    StreamWriter sw2 = new StreamWriter(saveFile2.FileName);
    List<string> universalLineList = new List<string>();
    string file = saveFile2.FileName;
    string[] splitFile = file. Split('\\');
    string[] savedName = splitfile[6].Split('.'); 
    int i = 1;

    sw2.WriteLine(savedName[0]);
    sw2.WriteLine("Created on: " + DateTime. Now. ToShortDateString() + " at: " + DateTime. Now. ToString("HH:mm:ss"));
    sw2.WriteLine();

    while (i < stepAndRepeatcounter)
    {
        sw2.WriteLine("Line: {0}", i);
        i++;
    }

    sw. WriteLine();

    foreach(var line in theUniversalList)
    {
        if (line. Name. ToUpper().Contains("FID"))
        {
            sw2.WriteLine("Fiducial: {0}, X: {1}, Y: {2}",
                          line. Name,
                          line. XPlacement,
                          line. YPlacement);
        }
    }

    sw2.WriteLine("Placements: ");

    foreach (var line in theUniversalList)
    {
        if (! line. Name. ToUpper().Contains("FID"))
        {
            sw2.WriteLine("Name: {0}, X: {1}, Y: {2}",
                          line. Name,
                          line. XPlacement,
                          line. YPlacement);
        }
    }

    int j = 0;
    sw2.WriteLine("Slots: ");
    foreach (var line in theUniversalList)
    {
        if (! line. Name. ToUpper().Contains("FID"))
        {
            sw2.WriteLine("Slot: {0}, P/D: {1}, P/N: {2}",
                          j,
                          line. PartDescription,
                          line. PartNumber);

            sw2.WriteLine("Slot: 22, P/D: Reject, P/N: {0}",
                          line. PartNumber);

            j++;
        }
    }

    sw2.Close();
}

catch (Exception)
{
    MessageBox. Show("Could not format and save Universal-1 Placements", "Universal-1 Save Error", MessageBoxButtons. OK, MessageBoxIcon. Warning);
}

A:

I think it's the following lines:
string file = saveFile2.FileName;
string[] splitFile = file. Split('\\');
string[] savedName = splitfile[6].Split('.'); 

I guess your path is not long enough for the 7th element, when you are running the file from the command line (maybe the path is then something like ".\xzy.txt"
To be 100% sure check the StackTrace of the exception too, to get the line with the error.