Knowledge.ToString()

Category: .Net

  • Parse Number List and Number Ranges in C#

    Have you ever had a need to parse list of numbers and number ranges? Wanted to convert it into strongly typed data? For example, string “2-5, 7, 9-15” should be converted into strongly typed objects for easier handling. Input is a string which consists of comma separate numbers or number ranges. Number ranges are indicated…

    |

  • Excel Interop Slow? 3 Ways to Boost Performance.

    Excel Interop Slow? Boost Performance with These Tricks

    Are you reading Excel file using Interop library? Is the application performance sluggish? Well, Interop is slow but that does not mean that you cannot improve performance. Understanding the root cause and avoiding pitfalls will surely help you improve the performance. Making a minor tweaks in code, I was able to reduce the time of…

    |

  • VB .Net to C# Conversion – RadioButton.CheckedChanged Event Not Firing

    Radio Button CheckedChanged event not firing in C# but fires in VB .Net

    In your Winforms application you have a radio button. If the user changes the value, you want to get notified. You will use RadioButton.CheckedChanged event. Your code works fine but here is a problem. The programming language you use determines when this event will be fired for the first time. If you are using VB…

    |

  • Step By Step Guide to Convert VB .NET Projects to C#

    Steps to successfully convert VB .NET to C# Projects

    Have you inherited VB .Net projects those were developed over years by multiple developers? You would definitely resonate my feeling when you think about converting VB .Net projects to C#. Of course, this conversion is not for faint of heart but careful planning, a good conversion tool and ample testing will help you successfully convert…

    |

  • FileNet Error: HTTPS is Required

    I am trying to push documents to FileNet using .Net 4.5 console application. This program is working fine on one machine but it does not work on another machine. I get the following error when I execute it: This error comes from FileNet.Api.dll. I tried to change the URL with https but it gave another…

    |

  • VB .Net – Calling a Function Calls Property Setter Method

    I encountered a nasty bug (technically: design) when I was using an HTML Web control in a WinForms application. I am storing html and plain text version of text into a SQL table. This control has InnerHtml and InnerText properties. Both of these properties have getter and setter. I was calling a 3rd party dll…

    |

  • .Net 3.5 System.Web.UI.DataVisualization namespace does not exists

    I was trying to compile an inherited VB .Net code that uses .Net 3.5 framework. When I compiled, it gave the following error The type or namespace name ‘DataVisualization’ does not exist in the namespace ‘System.Web.UI’ (are you missing an assembly reference?) Whatever answers I tried to find online could not give me details for…

    |

  • Weird errors for VB .Net classes defined in App_Code folder

    Recently I was making a .Net 3.5 webforms application compile on my computer. The application was written in VB .Net. There were couple of classes which were causing weird issues. Visual Studio compiler generated “variable not declared”, “Exception not declared”, “End Sub does not have matching sub”, “line continuation character does not work in VB…

    |

  • How to run a single instance of WinForm application?

    Following tutorial provides an example to run a single instance of WinForms application using Mutex. There are multiple ways to achieve the same result but this is kind of neat solution in my opinion. Add following SingleInstance class in your project. Here is how to use it in Program.cs > Main function

    |

  • Mailto Invalid URI: The Hostname Could Not be Parsed.

    If the Uri is “mailto”, the Uri format must be in the following format. I encountered following error It was difficult to find the root cause. Finally I found that I used “&subject” (ampersand) for the first parameter instead of “?subject” (question mark). Once I used “?subject”, everything worked as expected.

    |