初试VB.NET
- Windows Application
1
Public 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
8
End Class
9
10
Public Class Comp
11
Public Sub GetName()
12
MsgBox("HelloWorld")
13
End Sub
14
End Class
15
- Web Applicaiton
1
2
Partial Class _Default
3
Inherits System.Web.UI.Page
4
5
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
6
TextBox1.Text = "Hello VB.NET"
7
End Sub
8
End 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



浙公网安备 33010602011771号