TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Creating and runing a samplewinapp windows application in C#
Darwin Chaudhary
Sep 02, 2011
5.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
Here,we will look how to creating and running samplewinappl windows application
Introduction:
In this articals we wiil see how to creating and running a SampleWinApp windows application.
SampleWinApp is a window application that allows auser to click on a button named Click Me.when the button is clicked the click event occurs through which the click me text of the button changes to hello and vice-versa.to creat SampleWinApp windows application .net using microsoft visual studio,first of all :
we creat the form1 form
add code to form1 form
we can use f5 key or a combination od ctrl and f5 that is ctrl+f5 keys to run the sampleWinApp window application.
coding of the program:
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
namespace
WindowsFormsApplication10
{
public
partial
class
Form1
:
Form
{
int
i =0;
public
Form1()
{
InitializeComponent();
}
private
void
Form1_Load(
object
sender,
EventArgs
e)
{
}
private
void
button1_Click(
object
sender,
EventArgs
e)
{
i++;
if
(i % 2 != 0)
{
button1.Text =
"Hello"
;
MessageBox
.Show(
"The button has been clicked & the button text changed to
'Hello'."
);
}
else
{
button1.Text =
"clicked Me"
;
MessageBox
.Show(
"the button has been clicked and the button text changed to 'click
Me'."
);
}
textBox1.Show();
textBox1.Text=
"Click the button again and the button text changes."
;
textBox1.ReadOnly =
true
;
}
}
}
Ouput of the program:
Thank U. if you have any Suggestions and Comments about my blog, Please let me know.
Next Recommended Reading
How To Create Login Form In Windows Application Using C#