Archive for the ‘visual studio 2005’ Category

How to create Setup in visual studio ?

January 5, 2009

How to create Setup in visual studio?

  1. Open the project for which you need to create a setup
  2. Right click the Project name(topmost) in Solution Explorer and select Add->New->Project
  3. Select Setup and Deployment as the project type and enter the setup name & click Ok.
  4. Right Click Application Folder in the Left Pane and Select Add->Project Output
  5. Select Primary Output and click Ok.
  6. Select User’s Desktop in Left Pane and in Right Pane Right click and select Create New shortcut
  7. In the dialog that opens double click Application folder and Select Primary Output and Click Ok.
  8. Now a shortcut appears in right name, Rename it as you wish and this name will appear in the desktop when you install.
  9. Right click the shortcut and select Properties window. Change the icon Property to a image that you wish to have for ur appln. Before that add that image to the application folder.
  10. Select User’s Programs menu in Left pane and repeat the process you did for User’s Desktop so that an entry for your application appears in the start menu.

Finally In Solution Explorer Right Click Setup1 and click Build. Setup will be created in the applications containing folder.

How to make TextBox accept only Deecimal Values?

December 9, 2008
How to make textbox to allow decimal values in textbox in c#.net windows forms.

private void txtRate_KeyPress(object sender, KeyPressEventArgs  e)
{
    if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar) &&   !(e.KeyChar.Equals('.')))
          e.Handled =true;
}
Udhaya
PiSquare

Customizing TextBox

November 28, 2008

Allowing Only numbers in TextBox

Insert this code in KeyPress event of textBox

private void txtYear_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar))
e.Handled = true;
}

Allowing Only Letters & White Space in TextBox

private void cmbAuthor_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsLetter(e.KeyChar) && !char.IsControl(e.KeyChar) && !char.IsWhiteSpace(e.KeyChar))
e.Handled = true;
}

Setting Maximum Length of TextBox

Select the Text Box and Change the Max Length Propety

Udhaya

PiSquare