Category Archives: C#

Log files and Fail-friendly code

Oh my goodness. Thoughts for the day… Log file-based troubleshooting of deployed applications in limited-access environments has to be one of the most frustrating processes of application development. Magic numbers are EVIL. Lack of default cases is EVIL. Long strands … Continue reading

Posted in C#, Musings, Programming | Leave a comment

C# SystemColors class

I set the design-time background color of by-default-invisible controls to a vibrant Pale Green as an indication to the designer/developer/myself that this control won’t be visible unless made so. When working with the by-default-invisible controls, I typically change the .BackColor … Continue reading

Posted in C#, Programming | Leave a comment

Save a null value to a GUID field using C# SqlParameter

sCommand.Parameters.Add(“@employee_id”, SqlDbType.UniqueIdentifier).Value = (processEmployee_id == String.Empty ? System.Data.SqlTypes.SqlGuid.Null : new Guid(processEmployee_id));  

Posted in C#, Programming, SQL Server | Leave a comment

C# columnar Time zone conversions on populated DataTables

TLDR; the code below converts a DataTable’s time columns from UTC to local time, even when the DataTable is populated with data. My utility framework for general data displays queries a predefined content-specific DataTable into a DataGridView. The columns are automatically handled by … Continue reading

Posted in C#, Programming | 2 Comments

Easy way to apply filter to DataTable

Problem: Cannot directly apply a filter to a datatable. The application requires dynamic filtering for various criteria, altered at runtime by the user. Re-querying the database is not feasible; filters must be applied at the client upon a local DataTable. … Continue reading

Posted in C#, Programming | Leave a comment

Some free C# charting components / tools

Free C# Grid/Graph component Best Free Controls for .NET [closed] Which .net charting library should I use? ZedGraph: A flexible charting library for .NET   Thanks to  

Posted in C#, Programming | 1 Comment

Time to see what the other side is doing (moving from windows forms development to web apps)

I’ve been coding winforms for internal use. For the most part, I stick to professional standards, but I am willing to release less-polished applications than if I were selling them. Part of the implication of this is that I don’t … Continue reading

Posted in C#, Programming | Leave a comment

Replacing SSMS

Phil Factor’s thought-provoking article “Cold Turkey with SSMS” on a way to replace SQL Server Management Studio: I am in a position where it would be NICE to have a replacement for SSMS, but I lack the time and budget to build or buy a … Continue reading

Posted in C#, Office, Programming, SQL Server, System/DB Administration | Leave a comment

Remove bold formatting from copied DataGridView column headers

When copying from DataGridView and pasting to Excel, the column headers were bolded. This was undesirable, requiring a manual Paste Special… as Text or Unicode Text every time data was copied. This problem was resolved by adjusting the clipped data’s … Continue reading

Posted in C#, Programming | Leave a comment

Heads-down data entry into a list

This is a concise, user-friendly way to add intuitive functionality to a form that controls one or more lists of entries. It is optimized for 10-Key operators but will also work for QWERTY-mode users. Drop a Textbox and a Listbox onto the … Continue reading

Posted in C#, Programming | Leave a comment