Tuesday, April 26, 2011

Data Types and Access specifiers

Data Types in VB .NET 
      The Data types available in VB .NET, their size, type, description are summarized in the table below.
 
Data TypeSize in BytesDescriptionType
Byte18-bit unsigned integerSystem.Byte
Char216-bit Unicode charactersSystem.Char
Integer432-bit signed integerSystem.Int32
Double864-bit floating point variableSystem.Double
Long864-bit signed integerSystem.Int64
Short216-bit signed integerSystem.Int16
Single432-bit floating point variableSystem.Single
StringVariesNon-Numeric TypeSystem.String
Date8
System.Date
Boolean2Non-Numeric TypeSystem.Boolean
Object4Non-Numeric TypeSystem.Object
Decimal16128-bit floating point variableSystem.Decimal


Access Specifiers  Access specifiers let's us specify how a variable, method or a class can be used. The following are the most commonly used one's:

Public: Gives variable public access which means that there is no restriction on their accessibility.
Private: Gives variable private access which means that they are accessible only within their declaration content.
Protected: Protected access gives a variable accessibility within their own class or a class derived from that class.
Friend: Gives variable friend access which means that they are accessible within the program that contains their declaration.
Protected Friend: Gives a variable both protected and friend access.
Static: Makes a variable static which means that the variable will hold the value even the procedure in which they are declared ends.
Shared: Declares a variable that can be shared across many instances and which is not associated with a specific instance of a class or structure.
ReadOnly: Makes a variable only to be read and cannot be written.

 

Variables

    
Variables are used to store data. A variable has a name to which we refer and the data type, the type of data the variable holds. VB .NET now needs variables to be declared before using them. Variables are declared with the Dim keyword. Dim stands for Dimension.



Read more...

NameSpaces using in DotNet


Namespaces
            A namespace is a collection of different classes. All VB applications are developed using classes from the .NET System namespace. The namespace with all the built-in VB functionality is the System namespace. All other namespaces are based on this System namespace.

Some Namespaces and their use:

System: Includes essential classes and base classes for commonly used data types, events, exceptions and so on.
System.Collections: Includes classes and interfaces that define various collection of objects such as list, queues, hash tables, arrays, etc.
System.Data: Includes classes which lets us handle data from data sources.
System.Data.OleDb: Includes classes that support the OLEDB .NET provider.
System.Data.SqlClient: Includes classes that support the SQL Server .NET provider.
System.Diagnostics: Includes classes that allow to debug our application and to step through our code.
System.Drawing: Provides access to drawing methods.
System.Globalization: Includes classes that specify culture-related information.
System.IO: Includes classes for data access with Files.


System.Net: Provides interface to protocols used on the internet.
System.Reflection: Includes classes and interfaces that return information about types, methods and fields.
System.Security: Includes classes to support the structure of common language runtime security system.
System.Threading: Includes classes and interfaces to support multithreaded applications.
System.Web: Includes classes and interfaces that support browser-server communication.
System.Web.Services: Includes classes that let us build and use Web Services.
System.Windows.Forms: Includes classes for creating Windows based forms.
System.XML: Includes classes for XML support.



Read more...

Friday, April 22, 2011

Alert and Confirmation Message box in ASP.NET using VB.NET

In this article we will learn how to display alert and confirm message Box in ASP.NET.

Alert Message Box

In ASP.NET to display alert message Box using Java Script and make a alertmethod().
The below code define the Alert message Box.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication42.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/Javascript" language ="javascript" >
        function alert_meth() {
            alert("This show the alert MessageBox");
        }
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Button ID="Button1" runat="server" Style="z-index: 100; left: 64px; position: absolute;
top: 88px" Text="Alert" OnClientClick ="alert_meth()" Font-Bold="True" ForeColor="Red" Width="72px"/>
    </div>
    </form>
</body>
</html>

Now run the application.


Now click on the alert Button to display the alert MessageBox.






We can also define the Alert MessageBox with the Response.Write.
For example
Double click on the Button control and add the following code.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Response.Write("<script>alert('Hello')</script>")
End Sub

Confirmation Message box 

In ASP.NET web page to display the confirm Message box using java script.

The below code define the Java script to display confirm message Box.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication42.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   <script language="javascript" type="text/javascript">
function confirm()
{
if (confirm ==true)

else

return false;

}
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Button ID="Button1" runat="server" Style="z-index: 100; left: 64px; position: absolute;
top: 88px" Text="Confirm" Font-Bold="True" ForeColor="Brown" Width="72px"/>
    </div>
    </form>
</body>
</html>
Now double click on the button control and add the following code.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Button1.Attributes.Add("onclick", "return confirm('This is a confirm Box?');")
    End Sub

Now run the application and click on the Confirm Button.







Read more...

Starts with VB.Net

VB.Net provides the easiest, most productive language and tool for rapidly building windows and web applications. we can do the list of applications with VB.Net,

  1. Powerful windows Based Applications.
  2. Building Web Based Applications.
  3. Simplified Deployment.
  4. Powerful, Flexible, simplified Data Access.
  5. Improved Coding.
  6. Direct access to the Platform.
  7. Full Object-Oriented Constructs.
  8. XML web Services.
  9. Mobile Applications.
  10. COM Interoperability
  11. Reuse Existing Investments.
  12. Upgrade Wizard.Lets Begin with VB.NET in next Post itself......   

Read more...

The .Net Languages

The .Net FrameWork ships with three core languages that are commonly used for building ASP.NET Applications:
  1. VB
  2. C# (C Sharp)
  3. J#
These Languages are, to a large degree, functionality equivalent. Microsoft has worked to eliminate language conflicts in the .Net Framework.

Read more...

Introduction to Microsoft DotNet


DotNet is a Microsoft's Strategy of software that provides services to people any time, any place, on any device.

Microsoft .NET is Microsoft's new Internet strategy.
.NET was originally called NGWS.
 NGWS - Next Generation Windows Services

     Before the official announcement of .NET, the term NGWS was used for Microsoft's plans for producing an "Internet-based platform of Next Generation Windows Services".
Steve Ballmer quote January 2000:
"Delivering an Internet-based platform of Next Generation Windows Services is the top priority of our company. The breakthroughs we’re talking about here include changes to the programming model, to the user interface, to the application integration model, the file system, new XML schema....."
 

An Accurate Definition of .Net is,

It's an XML Web Services Platform,
  • which allows us to build rich .Net applications.
  • Which allows to interact with the internet using wide range of Smart Devices(Tablet Devices,Pocket  PC's, Web Phones, etc).
  • Which allows to build and integrate Web services and which comes with many rich set of  tools like Visual Studio to fully develop and build those applications.
  • .NET is based on the newest Web standards.  
  • .NET is a server centric computing model.    
  • .NET is a new Internet and Web based infrastructure.
  • .NET is NOT a new operating system.
  • .NET is a framework for universal services

        

.NET Internet Standards

.NET is built on the following Internet standards:
  • HTTP, the communication protocol between Internet Applications.
  • XML, the format for exchanging data between Internet Applications.
  • SOAP, the standard format for requesting Web Services.
  • UDDI, the standard to search and discover Web Services.

.NET Framework

The .NET Framework is the infrastructure for the new Microsoft .NET Platform. 

The .NET Framework is a common environment for building, deploying, and running Web Services and Web Applications.

The .NET Framework contains common class libraries - like ADO.NET, ASP.NET and Windows Forms - to provide advanced standard services that can be integrated into a variety of computer systems.

The .NET Framework is language neutral. Currently it supports C++, C#, Visual Basic, JScript (The Microsoft version of JavaScript) and COBOL. Third-party languages - like Eiffel, Perl, Python, Smalltalk, and others - will also be available for building future .NET Framework applications.

The new Visual Studio.NET is a common development environment for the new .NET Framework. It provides a feature-rich application execution environment, simplified development and easy integration between a number of different development languages.
      
                  
                       

Read more...