初试VB.NET

  1. Windows Application
     1Public Class Form1
     2
     3    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
     4        TextBox1.Text = "Helllo World"
     5        Dim s As New Comp
     6        Dim op As New System.IO.FileStream("c:\\cc",IO.FileMode.Create)
     7    End Sub

     8End Class

     9
    10Public Class Comp
    11    Public Sub GetName()
    12        MsgBox("HelloWorld")
    13    End Sub

    14End Class

    15

  2. Web Applicaiton
    1
    2Partial Class _Default
    3    Inherits System.Web.UI.Page
    4
    5    Protected Sub Button1_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles Button1.Click
    6        TextBox1.Text = "Hello VB.NET"
    7    End Sub

    8End Class

    9

     1<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
     2
     3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     4
     5<html xmlns="http://www.w3.org/1999/xhtml" >
     6<head runat="server">
     7    <title>Untitled Page</title>
     8</head>
     9<body>
    10    <form id="form1" runat="server">
    11    <div>
    12        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    13        <asp:Button ID="Button1" runat="server" Text="Button" /></div>
    14    </form>
    15</body>
    16</html>
    17
posted @ 2007-08-21 18:01  许晓光  阅读(249)  评论(0)    收藏  举报