我在网上copy了一个范例程序,关于datagrid某列的数据合计的,但运行后出现以下错误:编译错误 
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: BC30506: Handles 子句需要 WithEvents 变量。源错误: 行 23: 
行 24: Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
行 25: ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
行 26:    Select Case e.Item.ItemType
行 27:       Case ListItemType.AlternatingItem, ListItemType.Item
 
-------------------------------------------源代码如下:
<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.web.UI" %>
<%@ Import Namespace="System.web.UI.webcontrols" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.sqlclient" %>
<%@ Import Namespace="System.IO" %> <html>
<head>
<script language="VB" runat="server">
Private myTotal As System.Double 'This variable tracks the running total.Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
   'Connect to the database, retrieve data, and then fill the data in the DataSet.
   Dim myConnection As New SqlConnection("server=172.20.20.20;database=pmis;uid=sa;password=321")
   Dim myDataAdapter As New SqlDataAdapter("select * from pmis", myConnection)
   Dim myDataSet As New DataSet()
   myDataAdapter.Fill(myDataSet)   'Set the DataSource for the DataGrid, and then bind the data.
   DataGrid1.DataSource = myDataSet
   DataGrid1.DataBind()
End SubPrivate Sub DataGrid1_ItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
   Select Case e.Item.ItemType
      Case ListItemType.AlternatingItem, ListItemType.Item
           'Calculate total for the field of each row and alternating row.
           myTotal += CDbl(e.Item.Cells(2).Text)
           'Format the data, and then align the text of each cell to the right.
           e.Item.Cells(2).Text = Format(CDbl(e.Item.Cells(2).Text), "##,##0.00")
           e.Item.Cells(2).Attributes.Add("align", "right")
      Case ListItemType.Footer
           'Use the footer to display the summary row.
           e.Item.Cells(1).Text = "Total Sales"
           e.Item.Cells(1).Attributes.Add("align", "left")
           e.Item.Cells(2).Attributes.Add("align", "right")
           e.Item.Cells(2).Text = myTotal.ToString("c")
     End Select
End Sub
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body><asp:datagrid ID="datagrid1"  runat="server"
   AutoGenerateColumns="false" 
   bordercolor="black"
   gridlines="vertical"
   cellpadding=4
   cellspacing=0
   align="center"
   width="700"
   font-names="宋体"
   font-size="9pt"
   showfooter="true"
      headerstyle-backcolor="#cccc99"
  footerstyle-backcolor="#cccc99"
  itemstyle-backcolor="#ffffff"
  alternatingitemstyle-backcolor="#cccccc"></asp:datagrid></body>
</html>