vb.net Visual Basic 错误 BC30456 'Form1' 不是 'WindowsApplication1' 的成员
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32046516/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
visual basic error BC30456 'Form1' is not a member of 'WindowsApplication1'
提问by Oscar Kasil
Hello I am trying to do an exercise and keep getting this error when compiling.
您好,我正在尝试做一个练习,并在编译时不断收到此错误。
Visual Basic error BC30456 'Form1' is not a member of 'WindowsApplication1'
Visual Basic 错误 BC30456“Form1”不是“WindowsApplication1”的成员
I'm not sure how to fix it.
我不知道如何解决它。
Below is my code:
下面是我的代码:
Public Class frmCentsConverter
Private Sub txtAmount_TextChanged(sender As Object, e As EventArgs) Handles txtAmount.TextChanged
If IsNumeric(txtAmount.Text) Then
Dim NumberofCents As Integer
NumberofCents = CInt(txtAmount.Text)
lblDollars.Text = CStr(NumberofCents \ 100)
lblCents.Text = CStr(NumberofCents Mod 100)
End If
End Sub
Private Sub lblTitle_Click(sender As Object, e As EventArgs) Handles lblTitle.Click
End Sub
End Class
回答by Harrie
If you have renamed the startup form1 it is likely you also have to change the Startup form setting. You can find this setting to open 'My Project' in the 'Solution Explorer'. Select the Application section, change the 'startup form' as appropriate.
如果您重命名了启动窗体 1,则可能还必须更改启动窗体设置。您可以找到此设置以在“解决方案资源管理器”中打开“我的项目”。选择“应用程序”部分,根据需要更改“启动表单”。
Hope this will help, Harrie
希望这会有所帮助,哈里
回答by YourMother
Under the tab, Application.Designer.vb
在选项卡下,Application.Designer.vb
You'll see the following the code:
您将看到以下代码:
Me.MainForm = Global.WindowsApplication1.Form1
Me.MainForm = Global.WindowsApplication1。表格1
Change Form1to your NEW form name.
将Form1更改为您的新表单名称。
Example:Changed Form 1 "Hello World" to frmHello
示例:将表单 1“Hello World”更改为 frmHello
Original:Me.MainForm = Global.WindowsApplication1.Form1
原文:Me.MainForm = Global.WindowsApplication1.Form1
Change to:Me.MainForm = Global.WindowsApplication1.frmHello
更改为:Me.MainForm = Global.WindowsApplication1.frmHello
回答by Caleb McGlothin
To set the startup form in Windows Forms
在 Windows 窗体中设置启动窗体
- In Solution Explorer, right-click the project and choose Properties.
- The Project property page opens with the Application properties displayed.
- Choose the form you want as the startup form from the Startup Object drop-down list.
- 在解决方案资源管理器中,右键单击项目并选择属性。
- 项目属性页面打开,并显示应用程序属性。
- 从启动对象下拉列表中选择您想要的表单作为启动表单。
I got this information from this website:
我从这个网站得到了这个信息:
https://msdn.microsoft.com/library/a2whfskf(v=vs.100).aspx
https://msdn.microsoft.com/library/a2whfskf(v=vs.100).aspx
I can confirm this works on Visual Studio 2015 as well.
我可以确认这也适用于 Visual Studio 2015。
回答by tony
aha,,, I know how to fix it
啊哈,我知道怎么解决
if u get this problem, open the error message by clicking the error line till the Application.Designer.vb show up & then find the "Form1" name in that place
如果您遇到此问题,请通过单击错误行打开错误消息,直到 Application.Designer.vb 出现,然后在该位置找到“Form1”名称
sample in Application.Designer.vb tab :
Application.Designer.vb 选项卡中的示例:
......................
......................
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.aplikasi_set_diskumau.Form1
End Sub
......................
I found the "Form1" name in that part of code,, just replace that "Form1" name with the Form which you like to show up as the first startup form, hope it can solve the problem
我在那部分代码中找到了“Form1”名称,只需将“Form1”名称替换为您希望显示为第一个启动表单的Form,希望它可以解决问题