'visual basic error BC30456 'Form1' is not a member of 'WindowsApplication1'

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'

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


Solution 1:[1]

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.

Hope this will help, Harrie

Solution 2:[2]

To set the startup form in Windows Forms

  1. In Solution Explorer, right-click the project and choose Properties.
  2. The Project property page opens with the Application properties displayed.
  3. 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

I can confirm this works on Visual Studio 2015 as well.

Solution 3:[3]

Under the tab, Application.Designer.vb

You'll see the following the code:

Me.MainForm = Global.WindowsApplication1.Form1

Change Form1 to your NEW form name.

Example: Changed Form 1 "Hello World" to frmHello

Original: Me.MainForm = Global.WindowsApplication1.Form1

Change to: Me.MainForm = Global.WindowsApplication1.frmHello

Solution 4:[4]

It could be a bug after form renaming.

Try to change file Application.myapp under Project Folded

<MainForm>Form1</MainForm>

p.s. Application.Designer.vb is created dynamically, so changes there would be overwritten after the next clean build.

Solution 5:[5]

This is how I fixed it.

  1. Right click on the Name of your project and then click properties.
  2. Locate the Target framework under the Applications tab.
  3. Change it to ".NET Framework 4.5" (mine was on 4.5.2).
  4. Click/accept/whatever it is to confirm your selection from the popup box.
  5. Build/Rebuild solution. This worked for me in VB.net 2015. Good Luck!

Solution 6:[6]

I know how to fix it.

If you get this problem, open the error message by clicking the error line until Application.Designer.vb shows up & then find the "Form1" name in that place.

Sample in Application.Designer.vb tab:

    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" with the name of your form.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Caleb McGlothin
Solution 3 YourMother
Solution 4 Saman Salehi
Solution 5 frank watson
Solution 6 veryreverie