急!!!!!在线等!!!在线投票系统!~!!!出现下面的错误提示,不知道怎么修改?(错误提示+源代码)

yqyzzy 2004-10-19 08:32:00
运行时错误提示:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------

编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。

编译器错误信息: BC30408: 方法“Public Sub diaocha()”没有与委托“Delegate Sub EventHandler(sender As Object, e As System.EventArgs)”相同的签名。

源错误:



行 478: <tr>
行 479: <td>
行 480: <div align="center"><font color="#ff6600"><asp:button id="Button1" onclick="diaocha" runat="server" Text="我 要 投 票"></asp:button></font></div>
行 481: </td>
行 482: </tr>


源文件: D:\zyweb\index.aspx 行: 480







源代码:
Sub diaocha(ByVal sender As Object, ByVal e As System.EventArgs)
Dim k, i, j As Integer
Dim per(3) As Single
Dim result(3) As String
Dim id(3) As String
Dim txtreader As StreamReader
Dim txtwriter As StreamWriter
Dim trecord, votefile As String
Dim sum As Long
k = Request.Form("radiobutton")
votefile = Server.MapPath("diaocha.txt")
txtreader = File.OpenText(votefile)
i = 0
Do
trecord = Trim(txtreader.ReadLine())
If trecord <> "" Then
id(i) = Trim(Left(trecord, 2))
result(i) = Trim(Right(trecord, Len(trecord) - 2))
sum += CLng(result(j))
per(j) = CLng(result(j)) / sum
Session("0") = per(0)
Label6.Text = result(0)
Session("1") = per(1)
Label7.Text = result(1)
Session("2") = per(2)
Label8.Text = result(2)
Session("3") = per(3)
Label9.Text = result(3)
If i = k Then
j = CInt(result(i)) + 1
result(i) = Trim(CStr(j))
End If
i = i + 1
End If
Loop Until trecord = ""
txtreader.Close()
txtwriter = File.CreateText(votefile)
For j = 0 To (i - 1)
txtwriter.WriteLine(id(j) & " " & result(j))
Next

txtwriter.Close()
End Sub
...全文
112 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
luluso 2004-10-19
  • 打赏
  • 举报
回复
Sub diaocha(ByVal sender As Object, ByVal e As System.EventArgs)
这里有个ByVal但是你的
Delegate Sub EventHandler(sender As Object, e As System.EventArgs)
却没有

所以把Sub diaocha(ByVal sender As Object, ByVal e As System.EventArgs)
改成
Sub diaocha(sender As Object, ByVal e As System.EventArgs)
试试.

conquersky 2004-10-19
  • 打赏
  • 举报
回复
The button that is calling this function is not part of the datagrid and so is unable to provide DataGridCommandEventArgs. You need to reword the declaration to:



Sub ShowAdd(Sender As Object, E As System.EventArgs)

webdiyer 2004-10-19
  • 打赏
  • 举报
回复
不太熟悉vb,去掉 ByVal 试试
yqyzzy 2004-10-19
  • 打赏
  • 举报
回复
上面的兄弟,我不知道怎么修改,请给出修改的代码,谢谢!!!
活靶子哥哥 2004-10-19
  • 打赏
  • 举报
回复
不要在aspx内写button的onclick
在vs内选你的button 在属性面-事件板内 选Click的下拉筐是diaocha(...
luluso 2004-10-19
  • 打赏
  • 举报
回复
不是说了么?
方法“Public Sub diaocha()”没有与委托“Delegate Sub EventHandler(sender As Object, e As System.EventArgs)”相同的签名。

62,073

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧