Blue Theme Orange Theme Green Theme Red Theme
 
Nevron Gauge for SharePoint
Home | Forums | Videos | Photos | Blogs | Beginners | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Nevron Gauge for SharePoint
Search :       Advanced Search »
Home » Windows Server 2008 » Getting a Simple Start in .NET 3.0 Programming

Getting a Simple Start in .NET 3.0 Programming

This article is showing the basic operation of Button like as click event and getting the value from a textbox etc. Here we will learn how to add two no. in .NET 3.0. This article will help a lot to understand the basic of programming in .NET 3.0 to those which are new in .NET 3.0 Programming. This is a start, and more and new will come in next.

Author Rank :
Page Views : 5210
Downloads : 13
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
SumOfTwoNumber.zip
 
 
Team Foundation Server Hosting
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Getting a simple start in programming with .NET 3.0.

This article will help those, who are new in .NET 3.0 programming, and are not familiar very well with .NET 3.0. You can start from here with to do this type of simple programming. This is the start, we will learn more about .NET 3.0 programming in next. Here working with .NET 3.0 is very interesting. In .NET 3.0 we can do programming in a new way. Here animation is the most important future of .NET 3.0. XAML plays a vital role in .NET 3.0 Programming.

In this article I am showing that, how we can add two numbers in .net 3.0 Application. Firstly we have to design our window. Here we have to set our control with Margin property. Here margin property plays an important role in designing. We have to give four values for margin. First value is for Left align, Second value for Top align, Third value is for Right align and fourth value is for Bottom align. Here in .NET 3.0 designing the window is totally different from designing the window in ASP.NET 2.0.

 

Step 1:


Design a window, add three labels, add three textbox, add a Button. Set the margin property. Where you want to show these controls set the margin property according your design as you want to your Window look.

The Window1.xaml code will be look like as:

<Window x:Class="WindowsApplication4.Window1"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WindowsApplication4" Height="300" Width="300" >

    <Grid>

        <TextBox Height="25" Margin="105,27,11,0" Name="textBox1" VerticalAlignment="Top"></TextBox>

   

        <TextBox Margin="105,65,11,0" Name="textBox2" Height="25" VerticalAlignment="Top"></TextBox>

    
        <
Button Height="25" Margin="13,106,11,0" Name="button1" VerticalAlignment="Top" Click="button1_click">SUM</Button>

    
        <
TextBox Height="25" Margin="105,0,11,99" Name="textBox3" VerticalAlignment="Bottom"></TextBox>

   
          <
Label Height="25" HorizontalAlignment="Left" Margin="2,25,0,0" Name="label1" VerticalAlignment="Top" Width="101">Enter a no.</Label>

    
          <
Label Height="24" HorizontalAlignment="Left" Margin="3,66,0,0" Name="label2" VerticalAlignment="Top" Width="101">Enter Second No.</Label>

 

           <Label Height="25" HorizontalAlignment="Left" Margin="15,0,0,97" Name="label3" VerticalAlignment="Bottom" Width="87">Sum of No.</Label>

 

    </Grid>

</Window>

The window will become look like as:



Figure 1: The designing Window

Step 2:

Now the second step comes to do the code. Here we are going to add two numbers so we used here two TextBox to take the two numbers from the user. On the click event (Of button) we want to show the sum of these two numbers in a third TextBox. So we used here Button property click. The Window1.xaml.cs will be.

using System;

using System.Collections.Generic;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Shapes; 

 

namespace WindowsApplication4

{

    /// <summary>

    /// Interaction logic for Window1.xaml

    /// </summary>

 

    public partial class Window1 : System.Windows.Window

    {

 

        public Window1()

        {

            InitializeComponent();

        }

    
       
void button1_click(object source, System.EventArgs e)

        {

             int a, b, c;

             a = Int32.Parse(textBox1.Text);

             b = Int32.Parse(textBox2.Text);

             c = a + b;

             textBox3.Text = c.ToString();

        }

    }

}

Output:




Figure 2: The running application

Summary:

This article will help to understand the basic of .NET 3.0 programming. In next article we will learn more about .NET 3.0 programming.

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Rahul Kumar Saxena
Rahul shows great interests in working with Microsoft technologies. He specializes in the implementation of DataBase & Graphics. His area of expertise includes: C#, ASP.NET,ADO.NET,Windows Forms & Web Services. He hails from background , Master's in Computer Application. With programming he loves photography, traveling and reading books.
(Talabpur*)
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Team Foundation Server Hosting
Become a Sponsor
 Comments
niceeeeeeeeeeeeeeeee by pratik On September 8, 2007
its niccccceeeeeeeeeee , easyyyyyyy and simple
Reply | Email | Modify 
6 Months Free & No Setup Fees ASP.NET Hosting!
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.