The TableLayoutPanel control arranges its contents in a grid. TableLayoutPanel doesn’t have border color property, but you can write custom code in CellPaint event to create border. Here is the code snippet which will help you to create border and apply color for TableLayoutPanel Here is the screen shot of the Form in Design Time [...]
Posts Tagged: .Net 4.0
Using SynchronizationContext in Windows Forms
Long back I wrote a post about how to fix – System.InvalidOperationException – Cross-thread operation not valid exception, while we try to access user interface elements from a different thread, other than the thread(normally main thread), which created the user interface elements. .NET 2.0 brings us SynchoronizationContext which allows us to execute a section of [...]
How to upload file to FTP server using C#
From .net framework 2.0 onwards .net supports FTP operations. Like HttpWebRequest and HttpWebResponse, for FTP operations, FtpWebRequest and FtpWebResponse classes are available, under System.Net namespace. Here is the code snippet, which will help you to upload a file to FTP server, using C#. And here is the GetFileData function, which will return byte array from [...]
How to create controls dynamically in asp.net and retrieve values from it
Sometimes you may require to create controls dynamically in asp.net. Because of asp.net page life cycle, you may loss the created controls on next post back(ASP.Net framework recreate the page on postback). You can resolve this issue by overriding LoadViewState() and SaveViewState() methods. LoadViewState() method restores view-state information from a previous page request that was [...]
How to return value based on condition in Moq
Today I while writing unit test for one class I got a problem, I have factory method, which will return values based on the input given, and I want to mock this method. I was using Moq for mocking. And I found a solution like this. Happy Programming
Web application testing using WatiN and C#
Today I got a chance to explore web application testing with WatiN library. You can download WatiN from website. Or you can install via NuGet, using following command. I am using VS Express 2012 for Web, for testing my web application. I am testing a Login page, where I got two textboxes for username and [...]