Visit

Saturday, August 27, 2011

Display WinForm as Modal and Modeless

Forms and dialog boxes are either modal or modeless. A modal form or dialog box must be closed or hidden before you can continue working with the rest of the application.

To display a form as a modal dialog box ..Call the ShowDialog method.

The following example shows how to display a dialog box modally.

// C#
//Display frmAbout as a modal dialog
Form frmAbout = new Form();
frmAbout.ShowDialog();

# Use ShowDialog() method instead of Show() method.

Friday, August 19, 2011

How to use Shortcut Key in C Sharp (C#) Programm

How to use Shortcut Key in C Sharp (C#) Programm.

I am created 2 forms using c# (Form A and Form B). From Form A i want to open Form B when I press a Key from Keyboard (F2).

Steps

1. Set Form A KeyPreview Property to True.
2. Write needed code in Form A KeyDown Event.


private void A_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F2)
{
new B().Show();
}
}

Done...Check it out.

Wednesday, August 10, 2011

TreeView Node Click Event in CSharp (C#)


In TreeView We need to Do any operation when a node clicked or selected.We can't trigger an event with the name of Node. We have to do it by triggering Tree Views Event.In this example i am used 'NodeMouseClick' Event.

1. Add a TreeView Control to your Form.
2. Add the Needed Nodes .
3. Now Double Click on TreeViews 'NodeMouseClick' Event.

4. Now Compare with Node.Name or Node.Text in the Event.just see the Code below.


private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
// Compare By Node.Name
if (e.Node.Name == "NodeJava")
{
MessageBox.Show("JAVA");
}
//Or
// Compare By Node.Text
if (e.Node.Text == "C#")
{
MessageBox.Show("C#");
}
}


*'NodeJava' is the Node Name ..and 'C#' is the Node Text in my example Code.I am just checking and showing the result in a MessageBox.
Checkout and Do Comment Here..

Configure IIS - Internet Information Services For SQL Server in Windows 7


Configure IIS - Internet Information Services For SQL Server in Windows 7

This post describes the step by step details about configuring IIS in Windows 7 with the help of screen shots.

1. Go Start--Control Panel--Programs--Programs and Features
    Click on Turn Windows features on or off 


2. Now Check all the Check box Option Shown below

  • IIS 6 WMI Compatibility
  • IIS Metabase and IIS 6 configuration compatibility
  • IIS Management Console
  • .NET Extensibility
  • ASP .NET
  • ISAPI Extensions
  • ISAPI Filters
  • All Common Http Features (except  WebDAV Publishing).
  • Security --Windows Authentication.

Visual Studio 2008 sp1 full download ISO File From Microsoft Link


Visual Studio 2008 sp1 full download ISO File From Microsoft Link
Visual Studio 2008 sp1 full Offline Install ISO File From Microsoft Link

IMPORTANT
  • If you previously installed a Visual Studio 2008 Hotfix or Visual Studio 2008 SP1 pre-release, you must run the Service Pack Preparation tool before installing Visual Studio 2008 SP1.
  • If you have multiple Visual Studio products installed, you must upgrade all of them to SP1. If you have Visual Studio 2008 and one or more 2008 Express Editions, you cannot upgrade the Express Editions until you have upgraded Visual Studio.
  • Prior to installation, you should carefully review the included readme file to be aware of any known issues with this release.
  • The following technologies have been tested and verified to work with SP1:
    • Silverlight 2 SDK Beta 2 & Silverlight Tools Beta 2. (If Silverlight Tools Beta 2 is already installed, you must upgrade it after you install Visual Studio 2008 SP1. To upgrade, use the installer on the Silverlight Tools Beta 2 page on the Microsoft Download Center Web site.)

Friday, August 5, 2011

Get or Set Value of Selected Field in DataGridView in C Sharp (C#) WinForms


Get or Set Value of Selected Field in DataGridView using C Sharp (C#) WinForms.

1. Get Value of Selected Field in DataGridView.
in this example i am using a MessageBox to Show the selected fields value.

MessageBox.Show(dataGridView1.CurrentCell.Value.ToString());

1. Set Value to Selected Field in DataGridView.
You can set both string and int to the field.


// setting string value
dataGridView1.CurrentCell.Value = 101;

// setting string value
dataGridView1.CurrentCell.Value = "C Sharp-Language";


Check out the code and do comment here...

Add Rows to DataGridView in C Sharp (C#) WinForms


Add Rows to DataGridView in C Sharp (C#) WinForms

In C Sharp (C#) use Add() method to add Rows with values in DataGridView. Number of parameters depends upon the number of fields you added to a row.


dataGridView1.Rows.Add("CSharp-Language",786);

* dataGridView1 is the object of DataGridView.

I am used 2 parameters ( "CSharp-Language",786) because i am added two fields Name and ID in a Row in DataGridView.

Check out the code and do comment here...

Monday, August 1, 2011

MessageBox Examples in C# WinForms - CSharp WinForms

MessageBox Examples in C# WinForms - CSharp WinForms
1. Default MessageBox with OK button.

MessageBox.Show("Welcome to Csharp-Language.blogspot.com");
2. Default MessageBox with OK button and Title.
 
MessageBox.Show("Welcome to Csharp-Language.blogspot.com","C#Language");
3 .MessageBox with Yes , No , Cancel , Abort ,Retry and Ignore Button

A - MessageBox with Yes and No Button

MessageBox.Show("Do you want to Continue ?","Question",MessageBoxButtons.YesNo);