Posts

Showing posts from December, 2015

Scroll bar disappears on minimizing of window - C# .NET winform

Introduction While working on windows based project, I found a strange issue - on minimizing of window to  task bar  and returning to its normal state by maximizing, some of its controls and scroll bar were disappearing. Those get displayed automatically on changing of window’s state or  re-sizing  of the form. I tried lots to find out its solution over internet but I did not found any good solution, what I found is that this is a .NET bug which has been fixed in framework 4.5, whereas I was using .NET framework 3.5, and therefore looking for alternate solution. For detail, you can visit: http://www.codeproject.com/Questions/124373/scrollbar-disappears-while-resizing-the-window Solution While discussing with my senior, I found a hint about to override base class method OnSizeChanged(). After fighting with code lines while RnD and using Visual Studio class editor help, I found the solution what exactly I was looking, and the solution is given below: protected override

Format string with String.Format() method in C#

While programming you may need to build human understandable line(s) or para with dynamic values. In such cases, mostly developers either choose string concatenation or StringBuilder option in C# language. Manipulating strings with these results in mutability and immutability. For detail, please read difference between string concatenation and StringBuilder. Is it ok for frequent use, or in case of looping, or for large strings manipulations? Consider second case of formatting string with some calculated dynamic values, e.g. Decimal values to currency format, Splitting of date and time from DateTime value, Multiple string manipulation etc. These may become tricky or lengthy, if you choose general programming concepts. Also, to display user friendly messages, always in demand. With this article, we will understand how effectively we can format dynamic value with certain constant string line(s) or in paragraph, with less number of code lines. C# provided String.For