Web Form頁面的代碼: <%@ Page Language="vb" debug="true" AutoEventWireup="false" src="test.aspx.vb" Codebehind="test.aspx.vb" Inherits="_192._168._10._202.test" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <title>test</title> <META content="Microsoft Visual Studio .NET 7.0" name="GENERATOR"> <META content="Visual Basic 7.0" name="CODE_LANGUAGE"> <META content="JavaScript" name="vs_defaultClientScript"> <META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </HEAD> <BODY MS_POSITIONING="GridLayout"> <FORM id="Form1" method="post" runat="server"> <FONT face="宋體"> <OBJECT id="listbox1" style="Z-INDEX: 101; LEFT: 0px; WIDTH: 500px; POSITION: absolute; TOP: 0px; HEIGHT: 100px" classid="http:\bin\web_listbox.dll#System.Windows.Forms.UserControl.UserControl1" VIEWASTEXT> </OBJECT> </FONT></FONT></FORM> </BODY> </HTML> 這是Codebehind的代碼: Imports System Imports System.Windows Imports System.Windows.Forms.Form Public Class test Inherits System.Web.UI.Page Protected WithEvents listbox1 As System.Windows.Forms.ListBox #Region " Web 窗體設計器生成的代碼 " '該調用是 Web 窗體設計器所必需的。 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: 此方法調用是 Web 窗體設計器所必需的 '不要使用代碼編輯器修改它。 InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '在此處放置初始化頁的用戶代碼 ListBox1.Items.Insert(0, "asdfsdafsdfasdfdsafsdfasdfsdafasdfasfsdfasdfasdfasdfasdfasdfasdfasfsdafsadfsadfsdafsdafasdfasdfsd") ListBox1.Items.Insert(1, "sfshfsjfjsafjsadff") ListBox1.Items.Insert(2, "sdafsdafsadfjsdafjsjfjasdfkasjfkjasdfjkasdjfsjafjasfjasjfjasdkfjsajsadfjask") ListBox1.HorizontalExtent = 50000 ListBox1.HorizontalScrollbar = True End Sub End Class