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 = "*"
Visual Studio .NET Tips and Tricks, VB.NET Code Samples, C# Code Snippets, ASP.NET Code Samples, .NET Tips and Tricks, C# Tips & Tricks, Visual Studio 2010, .NET Framework Code Samples, VB.NET Tips & Tricks
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 = "*"
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
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;
}
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
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;
}
Here is a way to use the available default system colors like control, button face etc using C#
listView1.BackColor = System.Drawing.SystemColors.ControlDark;
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;
}