Windows Phone Developers

Saturday, June 13, 2009

How to mask the Password text in Textboxes (in VB.NET / C#)

It is simple to mask the characters entered in a textbox by setting the PasswordChar Property

The same can be done using C# code as shown below:

TextBox2.PasswordChar = "*"



Text Box without Mask
PasswordChar Property in TextBox

Masked Textbox


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Frame Control in VB.NET / C#

GroupBox control in .NET (Vb/C#)

GroupBox and Panel control provide the functionality similar to the Frame control in visual basic 6.0. Drag and Drop the Frame Control to the form and set its properties accordingly




Alter the properties from properties dialog box




Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Tuesday, April 21, 2009

How to Disable Custom Colors in ColorDialog using C# (.NET)

How to restrict the user to pre-defined colors in C# ColorDialog

With .NET’s ColorDialog one can select the pre-defined as well as the custom colors. For some reason, if you want only the pre-defined colors to be selected. Set the AllowFullOpen to false.

private void btnSelectColor_Click(object sender, EventArgs e)

{

colorDialog1.AllowFullOpen = false;

colorDialog1.ShowDialog();

this.BackColor = colorDialog1.Color;

}


ColorDialog with custom colors
Restricted ColorDialog

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Friday, April 17, 2009

How to use ColorDialog in C# (.NET)

Allow user to customize form background color using ColorDialog

The Windows Forms ColorDialog component is a pre-configured dialog box that allows the user to select a color from a palette and to add custom colors to that palette. It is the same dialog box that you see in other Windows-based applications to select colors. Use it within your Windows-based application as a simple solution in lieu of configuring your own dialog box.

To add the dialog to Windows Form select the ColorDialog from the tool box





The component will be dropped in the component-tray below the form


Use the following code to show the dialog and set the selected color as the background of the form

private void btnSelectColor_Click(object sender, EventArgs e)

{

colorDialog1.ShowDialog();

this.BackColor = colorDialog1.Color;

}



The form will be set as shown below




Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Saturday, March 7, 2009

Argument '1': cannot convert from 'int' to 'System.Windows.Forms.ListViewItem.ListViewSubItem'

The best overloaded method match for 'System.Windows.Forms.ListViewItem.ListViewSubItemCollection.Add(System.Windows.Forms.ListViewItem.ListViewSubItem)' has some invalid arguments

ListViewItem lView = new ListViewItem() ;

lView.SubItems.Add(36);

lView.SubItems.Add("36");

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

How to Set the Control’s background to system colors

Here is a way to use the available default system colors like control, button face etc using C#

listView1.BackColor = System.Drawing.SystemColors.ControlDark;



Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Sunday, February 22, 2009

Cannot implicitly convert type 'int' to 'System.Collections.Generic.IEnumerable

Cannot implicitly convert type 'int' to 'System.Collections.Generic.IEnumerable

public static IEnumerable<int> GetOdd()

{

// Use yield to return only the odd numbers.

foreach (int i in ints)

if (i % 2 == 1)

return i;

}

Check if you are missing any yield statement in the return

public static IEnumerable<int> GetOdd()

{

// Use yield to return only the odd numbers.

foreach (int i in ints)

if (i % 2 == 1)

yield return i;

}


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon