变量没有宣布它可能无法访问由于其保护级别 [英] variable is not declared it may be inaccessible due to its protection level

查看:1735
本文介绍了变量没有宣布它可能无法访问由于其保护级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的VB的技能是不是最好的,而这个问题已经把我难倒了几天。

My VB skills are not the best, and this problem has had me stumped for a few days.

在未在code定义的背后在Visual Studio中显示控件列表中,我可以鼠标悬停他们和工具提示文本弹出权利了。

In the list of controls shown in Visual Studio that are not defined in the code behind, I can "mouseover" them and the tooltip text pops right up.

类似的问题:

这人有没有解决办法 - var_name'is没有宣布。它可能无法访问由于其保护水平。在调试模式

This one had no solution - 'var_name'is not declared. It may be inaccessible due to its protection level.' in debug mode

这人说的解决办法是在web.config中,但我不明白的地方/怎么样 - BC30451:'MailValidation未声明。它可能无法访问由于其保护级别

This one said the solution was in the web.config, but I don't understand where/how - BC30451: 'MailValidation' is not declared. It may be inaccessible due to its protection level

这一次是一个拼写错误的单词 - vb.net错误:无法访问由于其保护级别

This one was a misspelled word - vb.net error: inaccessible due to its protection level

在我的 Tools.vb 模块,我有一个类来访问LDAP。

In my Tools.vb module, I have a class to access LDAP.

有关的工具类的命名空间在 login.aspx.vb code给出,但登录code不能识别的工具类。

The namespace for the tools class is given in the login.aspx.vb code, yet login code does not recognize the tools class.

推荐答案

狠抓错误的第一部分:变量未声明

Pay close attention to the first part of the error: "variable is not declared"

忽略第二部分:它可能无法访问由于其保护级别。这是一个红色的鲱鱼。

Ignore the second part: "it may be inaccessible due to its protection level". It's a red herring.

一些问题...(答案可能是你张贴形象,但我似乎无法使其变大,我的眼睛不看那个小字...任何机会,你可以张贴$在某种程度上,这些旧的眼睛可以读取C $ C吗?使得它很难知道整幅画面,尤其我怀疑你的页面指令。)

Some questions... (the answers might be in that image you posted, but I can't seem to make it larger and my eyes don't read that small of print... Any chance you can post the code in a way these older eyes can read it? Makes it hard to know the total picture. In particular I am suspicious of your Page directives.)

我们知道,1stReasonTypes是一个列表框,但由于某些原因,它好像我们不知道是哪个列表框。这就是为什么我想看到你的页面指令。

We know that 1stReasonTypes is a listbox, but for some reason it seems like we don't know WHICH listbox. This is why I want to see your page directives.

但同时,你是如何调用私有方法FormRefresh()?这不是一个事件处理程序,这使我怀疑,如果你试图在未在此code妥善处理后面的形式引用一个列表框。

But also, how are you calling the private method FormRefresh()? It's not an event handler, which makes me wonder if you are trying to reference a listbox in a form that is not handled properly in this code behind.

您可能需要找到控制1stReasonTypes。也许尝试把你的列表框里面像

You may need to find the control 1stReasonTypes. Try maybe putting your listbox inside something like

<div id="MyFormDiv" runat="server">.....</div>

然后FormRefresh(),做...

then in FormRefresh(), do a...

Dim 1stReasonTypesNew As listbox = MyFormDiv.FindControl("1stReasonTypes")

或使用现有的控制,对象或页,而不是一个div。上的FindControl更多信息:
http://msdn.microsoft.com/en-美国/库/ 486wc64h(v = vs.110)的.aspx

Or use an existing control, object, or page instead of a div. More info on FindControl: http://msdn.microsoft.com/en-us/library/486wc64h(v=vs.110).aspx

但无论你如何切它,也有一些是时髦打算在这里,这样1stReasonTypes不知道它的确切列表框它应该是。

But no matter how you slice it, there is something funky going here such that 1stReasonTypes doesn't know which exact listbox it's supposed to be.

这篇关于变量没有宣布它可能无法访问由于其保护级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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