Posts Tagged ‘ windows application ’

Number Only TextBox C# Windows Application

Put this code snippet your TextBox KeyPress Event, you will have your Number Only TextBox Working.

private void numberOnlyTextBox1_KeyPress(object sender, KeyPressEventArgs e)
 //allow digits only
 if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
   e.Handled = true;

 // allow one decimal point
 if (e.KeyChar == '.' && (sender as TextBox).Text.IndexOf('.') > -1)
  e.Handled = true;

A Rahim Khan


BackgroundWorker example in C# Windows Application

C# Component BackgroundWorker is used to accomplish time consuming task like mailing, taking Database Backup in a separate thread. First of all, you have to create an instance of BackgroundWorker to use it. Simply, drag and drop BackgroundWorker from ToolBox on your Form to have an instance or you may have your instance programmatically in the following way.

BackgroundWorker backgroundWorkerBackup = new BackgroundWorker();

Continue reading

ComboBox with DataGridView in C#

Using ComboBox with DataGridView is not that complex anymore but it’s almost mandatory while doing some data driven software development.

I have created a DataGridView like this one. Now, I want to show “Month” and “Item” instead of “MonthID” and “ItemID” in DataGridView.
Continue reading

Insert, Update, Delete with DataGridView Control in C# (Windows Application)

DataGridView control is one of the coolest features of Dot Net Framework. You can use this control in Windows Form using Wizard or programmatically.

Add a DataGridView control and two Buttons on a Form. One Button is for deleting the selected row and other one is for updating or inserting new row.

Declare those variables as shown below.
Continue reading

Project Deployment in Visual Studio 2008

Project Deployment is always a critical issue. Those following steps show how easily you can deploy your developed desktop projects. Setup and Deployment project for Desktop project can be of different types; Simple ones are Setup Project and Setup Wizard.

Here, I have chosen Setup Wizard type project to deploy the developed project.

Click Next to continue.

Choose setup type for windows application.

You can add image or text here file if you want.

Click Finish to create the Setup Project.

Select this newly created project, right click on it then click on properties to view the project properties. You can change Icon and title or other properties as marked in image.

Now, add the project you want to deploy as shown in image.

Add Project Output.

Select the project you want to deploy and click OK to continue.

Dependent DLLs or Dot Net Framework will added to Deployment Project.

Right Click on Deployment project and then select view. Clicking File System will bring you here. Now, you can create a folder in program menu and can add project output to it.

Click on User Interface to open the next window.

In User Interface, you can add dialog.

Here, I choose a Customer Informatiom Dialog to add in User Interface.

You can modify Customer Informatiom properties.

Last of all, you need to build your solution. Now, we have our setup file ready in project’s debug folder. However, this is a very simple kind of project deployment in Visual Studio 2008, more appropriately this one will just help to start.

A Rahim Khan