SunQuest
 
       ASP.NET Code
  Home arrow ASP.NET Code arrow Page 4 - ASP.NET Basics (part 2): Not My Type
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 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
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? 
ASP.NET CODE

ASP.NET Basics (part 2): Not My Type
By: Harish Kamath (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 27
    2003-07-30

    Table of Contents:
  • ASP.NET Basics (part 2): Not My Type
  • Building Blocks
  • A New Assignment
  • Strange Characters
  • Playing The Numbers
  • Operate With Caution
  • Everything Must Go
  • Cast And Credits
  • Mixing It Up
  • It's A Wrap

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    ASP.NET Basics (part 2): Not My Type - Strange Characters


    (Page 4 of 10 )

    A close relative of the "string" data type is the "char" data type. As you might have guessed, this data type is used to store a single character (unlike the "string" type, which is used to store a sequence of characters). Take a look at the next example, which demonstrates how character variables work.


    <script language="C#" runat="server">
    void Page_Load()
    {
    char saviour// define a character variable 

    saviour 'Q'// assign a value

    answer.Text "James Bond's favourite mad scientist is...<b>" saviour "</b>";

    }
    </script>
    <html>
    <head><title>James Bond Trivia</title></head>
    <body>
    <asp:label id="answer" runat="server" /></b>
    </body>
    </html>

    Here's the output.

    No rocket science here: the "char" keyword is used to define a character variable,


    <%
    char saviour// define a character variable 
    %>

    and the assignment operator is used to assign it a value.


    <%
    saviour 'Q'// assign a value
    %>

    If you have a sharp eye, you will notice that the initialization of a character variable is slightly different from that of a string variable - when initializing a character variable, you must use single quotes instead of double quotes, or else the program will barf and say the following:

    More ASP.NET Code Articles
    More By Harish Kamath (c) Melonfire


     

    ASP.NET CODE ARTICLES

    - How to Use the ListBox Control in ASP.NET 2.0
    - How to Load XML Documents in ASP.NET 2.0
    - DataGrid Code
    - ASP.NET Guestbook
    - User Controls and Client Side Scripting
    - ASP.NET Programming with Microsoft's AS...
    - ASP.NET Basics (part 3): Hard Choices
    - ASP.NET Basics (part 2): Not My Type
    - ASP.NET Basics (part 1): Nothing But .Net
    - Directory Tree Browser
    - How to get the confirmation of Yes/No from a...
    - Complete example using custom errors and wri...
    - Paging Certain # records per page .NET style
    - General Methods of formatting and Subtractin...
    - .NET LinkButton web control





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway