我一直收到“txtBox”没有宣布。由于其保护级别,它可能无法访问 [英] I keep receiving "txtBox" is not declared. it may be inaccessible due to its protection level

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

问题描述

嘿伙计们,

我刚刚开始使用visual basic&目前正在学习每个基本组件和关于如何使用Visual Basic创建系统(我正在创建库系统)的方法,因此使用Windows Forms App运行。

I just started using visual basic & currently learning each of the basic components & way on how to create System(i'm creating library system) using visual basic therefore running with Windows Forms App.

我在Youtube导师上仔细地遵循了每一步但不知何故它不起作用out&我仍然对我做错了哪一部分感到困惑。请帮助我们,我会尽力在这里打字,因为我无法发布图片:(

I followed every step carefully on Youtube tutor but somehow it didn't work out & i'm still confused on which part I did it wrong. Please help me guys, I'll try my best to type all in here since that i can't post images :(

我的编码:

_____________________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

问题:

1。"存在构建错误。是否要运行最后一次成功构建?"按"是"和"否"按钮,我点击"是"。

1. "There were build errors. Would you like to run the last succesful build?" follow by Yes & No button, I clicked Yes.

2. Visual Studio无法启动调试因为调试目标'C:\Users \acer\source\repos\Window缺少sApp1\WindowsApp1\bin\Debug \ WindowsApp1.exe。请构建项目并重试,或者适当地设置OutputPath和AssemblyName属性
以指向目标程序集的正确位置。

2. Visual studio cannot start debugging because the debug target 'C:\Users\acer\source\repos\WindowsApp1\WindowsApp1\bin\Debug\WindowsApp1.exe is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly.

3。错误列表:

BC30451 :未声明'txtBox'。由于其保护级别,它可能无法访问。

BC30451: 'txtBox' is not declared. it may be inaccessible due to its protection level.

ps:/对于' txtBox ',我做了根据我输入的内容关注AccessibleName。 

ps:/ For the 'txtBox', i did follow the AccessibleName according to what i type. 

推荐答案

假设您将TextBox从ToolBox拖到Form上,它的name属性将是TextBox1。除非您将该属性更改为txtBox,否则没有声明txtBox。

Assuming you dragged the TextBox onto the Form from the ToolBox it's name property would be TextBox1. Unless you altered that property to txtBox then there is no txtBox declared.

拖动到Form上的任何其他TextBox将按照数字顺序前进,即TextBox2然后TextBox3,依此类推,与所有控件一样。

Any additional TextBox's dragged onto the Form would advance in numerical sequence as added i.e. TextBox2 then TextBox3 and so on as with all controls.

因此,正确的代码是"TextBox1.Text ="。而不是"txtBox.Text ="。"

Therefore the proper code would be "TextBox1.Text =" and not "txtBox.Text =".

但是你没有提到是否手动更改了name属性。

But you do not mention if you altered the name property manually or not.


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

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