Wednesday, 22 December 2010
TreeSize
For me it has been always the case whenever I clean up my hard drive. It is just too tiring to right-click and check out the properties.
TreeSize (free) lets you do just that. The interface is a tree view which shows the sub-folders with their sizes.
http://www.jam-software.com/treesize_free/
Tuesday, 21 December 2010
Unpackage .msi file
MSIEXEC /a "msi file path"
The argument that works is "/a" which is for admin mode.
Sunday, 19 December 2010
Using a WinForms user control in WPF
Friday, 17 December 2010
Moving from WinForms to WPF
3) Button:
- How to write a multi-line text on the button?
As expected this doesn't work
<Button.Content> Hello\rthere<Button.Content/>
We need to use a TextBlock as Content, and use a <LineBreak /> in the text.
For e.g.:
<TextBlock>Test<LineBreak/> button</TextBlock>
WinForms Dock=Fill in WPF
You will need to remove Height, Width and Margin properties of the control to make it fill.
Wednesday, 1 December 2010
Important Links:
What To Know Before Debating Type Systems:
http://web.archive.org/web/20080822101209/http://www.pphsg.org/cdsmith/types.htmlThursday, 28 October 2010
Internet explorer has restricted this webpage from running scripts...
Royal TS - remote desktop tool
Tuesday, 12 October 2010
LINQ – fetching controls on the WinForm
Let us take a simple example, but a useful one. We start with a form, having 3 text boxes and a button. The button validates whether all the text boxes are filled up or not (a common business case).
We want to color background of the textboxes Red if they are empty:
var textBoxes = from tBox in this.Controls.OfType<TextBox>()where tBox.Text.Trim() == ""select tBox;foreach (TextBox tbox in textBoxes){tbox.BackColor = Color.Red;}
We get the same result as before. Building upon this, right now we get all the text boxes but what if we want to check only the visible text boxes? We should be able to achieve it by adding ‘tBox.Visible == true’ in the LINQ query. Which brings us to the question, how do we add AND condition in LINQ? (along the way let’s add Enabled condition as well)
var textBoxes =from tBox in this.Controls.OfType<TextBox>()where tBox.Text.Trim() == "" &&tBox.Visible == true &&tBox.Enabled == trueselect tBox;
For testing the OR condition, we select not just text boxes but Combo Boxes as well.
var controls =from Control ctl in this.Controlswhere (ctl is TextBox || ctl is ComboBox) &&(ctl.Text.Trim() == "" && ctl.Visible == true && ctl.Enabled == true)select ctl;
Sunday, 1 August 2010
WPF Commands
Friday, 30 July 2010
Binding to ListData (with IsSynchronizedWithCurrentItem)
Wednesday, 28 July 2010
Tool to download complete web site
Sunday, 25 July 2010
Important links
Friday, 16 July 2010
SlickRun custom magic words
Thursday, 15 July 2010
Dev Tools
Wednesday, 7 July 2010
Using Attributes
Sunday, 13 June 2010
Links to training kits
Tuesday, 11 May 2010
Comparing assembly versions in C#
Version version2 = new Version("2.5");
if (version1 <= version2)
{
// in this case true
}
No need to rely on string.Compare() method !!
Thursday, 6 May 2010
Wednesday, 5 May 2010
How to set the default encoding in windows
Web links discussing encoding in Windows
Encoding to use while reading/writing files in .NET
While performing File I/O, it is important to keep in mind whether the files being processed can contain special characters or not. If it is so, then check the encoding you are using.
Encoding used in:
StreamReader: it uses UTF-8 encoding by default unless otherwise specified.
StreamWriter: Uses the default encoding of the system unless otherwise specified.
If we do a check on the default encoding - we get "Windows-1252" [which is ANSI]. So while development if we don't specify encoding (and use defaults) then the files created by applications will use ANSI encoding, and applications reading them will use UTF-8!!!
Solution:
- We can use encoding "Windows-1252" when reading the file or
- use encoding UTF-8 while writing /reading the files (better approach)
Tuesday, 4 May 2010
Invalid characters (square boxes) while reading a text file (encoding issue)
Wednesday, 28 April 2010
Delete from a table which requires lookup in another table
Tuesday, 27 April 2010
Get distinct rows from DataTable
Shorts - week 3, 2022
Post with links to what I am reading: 1. A very good post on different aspects of system architecture: https://lethain.com/introduction-to-a...
-
Let’s look at another often used control in business applications – TreeView. It is a great control to visualise hierarchical data. Take an ...
-
Yesterday evening one of our test servers automatically rebooted. And today morning we found out that the last night’s test run was interrup...