Signs of things to come



  • I've been tasked with adding new functionality to an existing C# Windows application. Having a read through the code to (try) understand what/when/how, I come across the "ExportToExcel" function...

                Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
                if (xlApp == null)
                {
                    Console.WriteLine("EXCEL could not be started. Check that your office installation and project references are correct.");

                   // snip

                }



  • try
    {
        try
        {
            _isSelected = (bool)_dgvRow.Cells["Selected"].Value;
        }
        catch (ArgumentException)
        {
            _isSelected = (bool)_dgvRow.Cells["IsSelected"].Value;
        }
    }
    catch (Exception)
    {
        //Temp Hack in case "Selected" Column does not exist
    }



  • @Brian Fernandes said:

    I've been tasked with adding new functionality to an existing C# Windows application. Having a read through the code to (try) understand what/when/how, I come across the "ExportToExcel" function...

                Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
                if (xlApp == null)
                {
                    Console.WriteLine("EXCEL could not be started. Check that your office installation and project references are correct.");

                   // snip

                }

    And? What's the problem?



  • @Brian Fernandes said:


        //Temp Hack in case "Selected" Column does not exist
    How long has the temp hack been in the production code?



  • @bstorer said:

    How long has the temp hack been in the production code?
     

    Why do you even ask this question?



  • @toth said:

    And? What's the problem?

    the new operator will never return null.

    BTW, in the horrible German translation of Visual Studio 2008 they translated the error message "use the 'new' keyword", by "Benutzen Sie das 'neue' Schlüsselwort" (i. e. translated new as an adjective instead of keeping it as is).



  • @dhromed said:

    @bstorer said:

    How long has the temp hack been in the production code?
     

    Why do you even ask this question?

    Because a temp hack as a stopgap on a critical bug isn't a necessarily a WTF.  I'm trying to explore different territory because the initial WTF bores the shit out of me.

Log in to reply