Handles子句需要在包含类型或其基本类型之一中定义的WithEvents变量 [英] Handles clause requires a WithEvents variable defined in the containing type or one of its base types

查看:61
本文介绍了Handles子句需要在包含类型或其基本类型之一中定义的WithEvents变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误

Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

在下面的代码中.

Public Sub selCurrentManuf_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles selCurrentManuf.SelectedIndexChanged

    End Sub

与之配套的下拉列表如下...

The drop list to go with it is the following...

<asp:DropDownList  
   OnSelectedIndexChanged="selCurrentManuf_SelectedIndexChanged" 
   selectedvalue='<%#Container.DataItem("c1_manufidcurrent")%>' 
    ID="selCurrentManuf" 
    Runat="Server" 
    DataTextField="c4_Desc" 
    DataValueField="c4_manufid"
    DataSource="<%# GetCurrentManuf() %>" 
    autopostback="true" 
 ></asp:DropDownList>

推荐答案

当我为某些字段重命名时,出现了此错误.出于某种原因,有时设计者会搞砸并且不会在form.aspx.designer.vb文件中对其进行重命名,如果您在其中查找并修复名称,则如果您遇到这种情况,它可以解决此问题.

I've gotten this error when for some I've renamed a field. For some reason sometimes the designer messes up and doesn't rename it in the form.aspx.designer.vb file, if you look in there and fix the name it can fix this issue if that has happened to you.

因此,请仔细检查偶数处理程序,aspx文件和designer.aspx文件中的字段名称是否相同.

So double check that the field name is the same in your even handler, the aspx file and the designer.aspx files.

这篇关于Handles子句需要在包含类型或其基本类型之一中定义的WithEvents变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆