BC31143错误VB.NET [英] BC31143 error VB.NET

查看:117
本文介绍了BC31143错误VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我有一个问题



它最近工作正常,但似乎我已经做了一些改变,使得这个错误能够弹出。



我有一系列文本框

tboks = {tB_1, TB_2,TB_3,......等等。现在,如果我使用以下代码,则需要




Hi all

I have a question

It used to work properly recently but it seems that I've done some changes that enabled this error to pop up.

I have an array of textboxes
tboks = {tB_1,TB_2,TB_3,...etc}

now if I use a following code:

For i = 0 To tboks.Count - 1

            AddHandler tboks(i).Enter, AddressOf tboks_Enter
            AddHandler tboks(i).KeyDown, AddressOf tboks_KeyDown
            AddHandler tboks(i).MouseDown, AddressOf tboks_MouseDown

Next

Private Sub tboks_MouseDown(sender As Object, e As MouseEventArgs)

Msgbox("hi")

End Sub
Private Sub tboks_KeyDown(sender As Object, e As KeyEventArgs)

Msgbox("hi")

End Sub
Private Sub tboks_Enter(sender As Object, e As EventArgs)

Msgbox("hi")

End Sub





前两个产生此错误BC31143:



方法'Private Sub tboks_KeyDown(sender As Object,e As KeyEventArgs)'没有与委托'Delegate Sub KeyEventHandler(sender As Object,e As KeyEventArgs)兼容的签名'



方法'Private Sub tboks_MouseDown(sender As Object,e As MouseEventArgs)'没有与委托'Delegate Sub MouseEventHandler(sender As Object,e As MouseEventArgs)兼容的签名'





第三个子工作正常。



所以我认为它必须是鼠标,关键事件处理代码的问题...也许一些后面的代码被破坏了...



谢谢



我尝试过:



我在单个文本框(TB_1)上尝试了鼠标,它也可以正常工作。

但是在一个数组中它们都疯了......



The first two produce this error BC31143:

Method 'Private Sub tboks_KeyDown(sender As Object, e As KeyEventArgs)' does not have a signature compatible with delegate 'Delegate Sub KeyEventHandler(sender As Object, e As KeyEventArgs)'
and
Method 'Private Sub tboks_MouseDown(sender As Object, e As MouseEventArgs)' does not have a signature compatible with delegate 'Delegate Sub MouseEventHandler(sender As Object, e As MouseEventArgs)'


The third sub works just fine.

So I'm thinking it has to be a problem with the mouse,key event handling code... perhaps some back code got ruined...

Thank you

What I have tried:

I tried the mouse down on a single textbox (TB_1) and it works just fine also.
But in an array it all goes crazy...

推荐答案

您可能需要检查这些AddressOf语句中的名称:



tboks _1_ KeyDown

tboks _1 _ MouseDown
You might want to check the names in those AddressOf statements:

tboks_1_KeyDown
tboks_1_MouseDown


我找到了解决方案。似乎我做了一些禁用system.windows.forms的更改



我注意到当我在单个文本框上创建一个mousedown子代码时生成的代码(e system.windows) .forms.mouseeventargs)而不仅仅是(e mouseventargs)



所以现在我刚刚添加
I found a solution. It seems I made some changes that disabled system.windows.forms

I noticed that when I created a mousedown sub on a single textbox the code generated (e system.windows.forms.mouseeventargs) instead of just (e mouseventargs)

So for now I just added
import system.windows.forms

到了班级的顶部





所以我原来的问题现在已经解决了,而且代码有效......虽然我得到了现在警告如:



警告CA2240添加GetObjectData的实现以键入'DS_admin'



但是与我原来的问题不符......

to the top of the class


So my original question is now solved and the code works...though I get now warnings like:

Warning CA2240 Add an implementation of GetObjectData to type 'DS_admin'

But that is out of the line with the original question i guess...


这篇关于BC31143错误VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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