C#
  Home arrow C# arrow Page 4 - C# Simplified, part 7: Working with WinFor...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

C# Simplified, part 7: Working with WinForm Controls
By: Anand Narayanaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2005-06-14

    Table of Contents:
  • C# Simplified, part 7: Working with WinForm Controls
  • Working with Checkboxes
  • Working with RadioButtons
  • Working with Labels
  • Working with Combo boxes
  • Working with List boxes

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    C# Simplified, part 7: Working with WinForm Controls - Working with Labels


    (Page 4 of 6 )

    A label is one of the important controls used with all kinds of applications, be they Windows or ASP.NET applications. They normally sit alongside the Textbox control, but labels will also find a place with other controls such as combo box and list box as well. It tells you what information to enter inside a specific control. The text inside the label controls cannot be edited. It cannot be modified by users. Listing 7.4 adds a Textbox and a label control to the form. Once you have worked with this example you can further modify the program by adding more controls.

    Label 7.4

    001: using System;
    002: using System.Drawing;
    003: using System.Windows.Forms;
    004:
    005: public class MyLabel: Form
    006: {
    007:
    008:   // Object of TextBox created
    009:   TextBox t1 = new TextBox();
    010:   // Object of Label created
    011:   Label l1 = new Label();
    012:
    013:   MyLabel()
    014:   {
    015:     this.Controls.Add(l1);
    016:     this.Controls.Add(t1);
    017:     t1.Location = new Point(50,50);
    018:     t1.Size = new Size(200,70);
    019:     t1.Multiline = true;
    020:     t1.ScrollBars = ScrollBars.Vertical;
    021:     t1.CharacterCasing = CharacterCasing.Upper;
    022:
    023:     l1.Text = "Enter your comments:";
    024:     l1.Location = new Point(50,30);
    025:     l1.Size = new Size(150,20);
    026:
    027:     this.Text = "Label Control Demo";
    028:   }
    029:
    030:   public static void Main()
    031:   {
    032:     Application.Run(new MyLabel());
    033:   }
    034: }

    Output

    Figure 7.4

    More C# Articles
    More By Anand Narayanaswamy


     

    C# ARTICLES

    - C# and XML
    - Pointers and Arrays in C#
    - C# 3.0 Extension Methods
    - Overloading Operators in C#
    - Iterators and Nullable Types
    - Patterns and Iterators in C#
    - C# Exceptions
    - Methods in C#
    - Delegates and Events in C#
    - Advanced C#
    - Working with Regular Expressions in C#
    - Sending Simple E-Mail in C#
    - Building C# Comparable Objects: IComparable ...
    - Color Transformation Applications in C# GDI+...
    - Performing Color Transformation Operations i...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT