当我尝试重命名我的课程时,我遇到了设计师错误

时间:2016-09-17 17:39:58

标签: vb.net

这是我发布的上一个问题的后续跟进。我以某种方式改变了我的分类名称。 Public Class ButtonRestart

它有效,但是当我尝试将其重命名为最初调用的内容时(Public Class SBCL)我在设计器中出错。

  

可以设计ButtonRestart类,但不是文件中的第一个类。 Visual Studio要求设计人员使用文件中的第一个类。移动类代码,使其成为文件中的第一个类,然后再次尝试加载设计器。

Public Class ButtonRestart

Dim score As Integer

Private Sub Button_Click(sender As Object, e As EventArgs) Handles Button9.Click, Button8.Click, Button7.Click, Button6.Click, Button5.Click, Button4.Click, Button3.Click, Button27.Click, Button26.Click, Button25.Click, Button24.Click, Button23.Click, Button22.Click, Button21.Click, Button20.Click, Button2.Click, Button19.Click, Button16.Click, Button15.Click, Button14.Click, Button13.Click, Button12.Click, Button11.Click, Button10.Click, Button1.Click
    Dim button = TryCast(sender, Button)
    If button Is Nothing Then Exit Sub

    score = score + 1
    MsgBox(score & " points out of 25")
    button.Enabled = False
    ProgressBar1.Value = ProgressBar1.Value + 4

    If score = 13 Then
        MsgBox("You are more way done! You can call out the scammer now or keep going!")
    End If

    If score = 25 Then
        MsgBox("Guaranteed scammer!! Call out the scammer now!!!!!!!!!!!!!1")
    End If

End Sub

Private Sub ButtonExit_Click(sender As Object, e As EventArgs) Handles ButtonExit.Click
    Close()
End Sub

Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs)
    MsgBox("Created by Nathen35 of Moonboy Games")
End Sub

Private Sub ChangeLogToolStripMenuItem_Click(sender As Object, e As EventArgs)
    MsgBox("Version 0.5 Beta. Removed reset button(for now). Changed from 16 to 25 buttons. Half-way and Completed messages now pop up when you reach 13 and 25.")
End Sub

End Class

Designer.vb

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class ButtonRestart
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()>
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()>
    Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ButtonRestart))
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.Button3 = New System.Windows.Forms.Button()
        Me.Button4 = New System.Windows.Forms.Button()
        Me.Button5 = New System.Windows.Forms.Button()
        Me.Button6 = New System.Windows.Forms.Button()
        Me.Button7 = New System.Windows.Forms.Button()
        Me.Button8 = New System.Windows.Forms.Button()
        Me.Button9 = New System.Windows.Forms.Button()
        Me.Button10 = New System.Windows.Forms.Button()
        Me.Button11 = New System.Windows.Forms.Button()
        Me.Button12 = New System.Windows.Forms.Button()
        Me.Button13 = New System.Windows.Forms.Button()
        Me.Button14 = New System.Windows.Forms.Button()
        Me.Button15 = New System.Windows.Forms.Button()
        Me.Button16 = New System.Windows.Forms.Button()
        Me.Title = New System.Windows.Forms.Label()
        Me.Info = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Button19 = New System.Windows.Forms.Button()
        Me.Button20 = New System.Windows.Forms.Button()
        Me.Button21 = New System.Windows.Forms.Button()
        Me.Button22 = New System.Windows.Forms.Button()
        Me.Button23 = New System.Windows.Forms.Button()
        Me.Button24 = New System.Windows.Forms.Button()
        Me.Button25 = New System.Windows.Forms.Button()
        Me.Button26 = New System.Windows.Forms.Button()
        Me.Button27 = New System.Windows.Forms.Button()
        Me.ButtonExit = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Button1
        '
        resources.ApplyResources(Me.Button1, "Button1")
        Me.Button1.Name = "Button1"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Button2
        '
        resources.ApplyResources(Me.Button2, "Button2")
        Me.Button2.Name = "Button2"
        Me.Button2.UseVisualStyleBackColor = True
        '
        'Button3
        '
        resources.ApplyResources(Me.Button3, "Button3")
        Me.Button3.Name = "Button3"
        Me.Button3.UseVisualStyleBackColor = True
        '
        'Button4
        '
        resources.ApplyResources(Me.Button4, "Button4")
        Me.Button4.Name = "Button4"
        Me.Button4.UseVisualStyleBackColor = True
        '
        'Button5
        '
        resources.ApplyResources(Me.Button5, "Button5")
        Me.Button5.Name = "Button5"
        Me.Button5.UseVisualStyleBackColor = True
        '
        'Button6
        '
        resources.ApplyResources(Me.Button6, "Button6")
        Me.Button6.Name = "Button6"
        Me.Button6.UseVisualStyleBackColor = True
        '
        'Button7
        '
        resources.ApplyResources(Me.Button7, "Button7")
        Me.Button7.Name = "Button7"
        Me.Button7.UseVisualStyleBackColor = True
        '
        'Button8
        '
        resources.ApplyResources(Me.Button8, "Button8")
        Me.Button8.Name = "Button8"
        Me.Button8.UseVisualStyleBackColor = True
        '
        'Button9
        '
        resources.ApplyResources(Me.Button9, "Button9")
        Me.Button9.Name = "Button9"
        Me.Button9.UseVisualStyleBackColor = True
        '
        'Button10
        '
        resources.ApplyResources(Me.Button10, "Button10")
        Me.Button10.Name = "Button10"
        Me.Button10.UseVisualStyleBackColor = True
        '
        'Button11
        '
        resources.ApplyResources(Me.Button11, "Button11")
        Me.Button11.Name = "Button11"
        Me.Button11.UseVisualStyleBackColor = True
        '
        'Button12
        '
        resources.ApplyResources(Me.Button12, "Button12")
        Me.Button12.Name = "Button12"
        Me.Button12.UseVisualStyleBackColor = True
        '
        'Button13
        '
        resources.ApplyResources(Me.Button13, "Button13")
        Me.Button13.Name = "Button13"
        Me.Button13.UseVisualStyleBackColor = True
        '
        'Button14
        '
        resources.ApplyResources(Me.Button14, "Button14")
        Me.Button14.Name = "Button14"
        Me.Button14.UseVisualStyleBackColor = True
        '
        'Button15
        '
        resources.ApplyResources(Me.Button15, "Button15")
        Me.Button15.Name = "Button15"
        Me.Button15.UseVisualStyleBackColor = True
        '
        'Button16
        '
        resources.ApplyResources(Me.Button16, "Button16")
        Me.Button16.Name = "Button16"
        Me.Button16.UseVisualStyleBackColor = True
        '
        'Title
        '
        resources.ApplyResources(Me.Title, "Title")
        Me.Title.Name = "Title"
        '
        'Info
        '
        resources.ApplyResources(Me.Info, "Info")
        Me.Info.Name = "Info"
        '
        'Label3
        '
        resources.ApplyResources(Me.Label3, "Label3")
        Me.Label3.Name = "Label3"
        '
        'ProgressBar1
        '
        resources.ApplyResources(Me.ProgressBar1, "ProgressBar1")
        Me.ProgressBar1.Name = "ProgressBar1"
        '
        'Label1
        '
        resources.ApplyResources(Me.Label1, "Label1")
        Me.Label1.Name = "Label1"
        '
        'Button19
        '
        resources.ApplyResources(Me.Button19, "Button19")
        Me.Button19.Name = "Button19"
        Me.Button19.UseVisualStyleBackColor = True
        '
        'Button20
        '
        resources.ApplyResources(Me.Button20, "Button20")
        Me.Button20.Name = "Button20"
        Me.Button20.UseVisualStyleBackColor = True
        '
        'Button21
        '
        resources.ApplyResources(Me.Button21, "Button21")
        Me.Button21.Name = "Button21"
        Me.Button21.UseVisualStyleBackColor = True
        '
        'Button22
        '
        resources.ApplyResources(Me.Button22, "Button22")
        Me.Button22.Name = "Button22"
        Me.Button22.UseVisualStyleBackColor = True
        '
        'Button23
        '
        resources.ApplyResources(Me.Button23, "Button23")
        Me.Button23.Name = "Button23"
        Me.Button23.UseVisualStyleBackColor = True
        '
        'Button24
        '
        resources.ApplyResources(Me.Button24, "Button24")
        Me.Button24.Name = "Button24"
        Me.Button24.UseVisualStyleBackColor = True
        '
        'Button25
        '
        resources.ApplyResources(Me.Button25, "Button25")
        Me.Button25.Name = "Button25"
        Me.Button25.UseVisualStyleBackColor = True
        '
        'Button26
        '
        resources.ApplyResources(Me.Button26, "Button26")
        Me.Button26.Name = "Button26"
        Me.Button26.UseVisualStyleBackColor = True
        '
        'Button27
        '
        resources.ApplyResources(Me.Button27, "Button27")
        Me.Button27.Name = "Button27"
        Me.Button27.UseVisualStyleBackColor = True
        '
        'ButtonExit
        '
        resources.ApplyResources(Me.ButtonExit, "ButtonExit")
        Me.ButtonExit.Name = "ButtonExit"
        Me.ButtonExit.UseVisualStyleBackColor = True
        '
        'ButtonRestart
        '
        resources.ApplyResources(Me, "$this")
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer))
        Me.ControlBox = False
        Me.Controls.Add(Me.ButtonExit)
        Me.Controls.Add(Me.Button27)
        Me.Controls.Add(Me.Button26)
        Me.Controls.Add(Me.Button25)
        Me.Controls.Add(Me.Button24)
        Me.Controls.Add(Me.Button23)
        Me.Controls.Add(Me.Button22)
        Me.Controls.Add(Me.Button21)
        Me.Controls.Add(Me.Button20)
        Me.Controls.Add(Me.Button19)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.ProgressBar1)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Info)
        Me.Controls.Add(Me.Title)
        Me.Controls.Add(Me.Button16)
        Me.Controls.Add(Me.Button15)
        Me.Controls.Add(Me.Button14)
        Me.Controls.Add(Me.Button13)
        Me.Controls.Add(Me.Button12)
        Me.Controls.Add(Me.Button11)
        Me.Controls.Add(Me.Button10)
        Me.Controls.Add(Me.Button9)
        Me.Controls.Add(Me.Button8)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Name = "ButtonRestart"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

    Friend WithEvents Button1 As Button
    Friend WithEvents Button2 As Button
    Friend WithEvents Button3 As Button
    Friend WithEvents Button4 As Button
    Friend WithEvents Button5 As Button
    Friend WithEvents Button6 As Button
    Friend WithEvents Button7 As Button
    Friend WithEvents Button8 As Button
    Friend WithEvents Button9 As Button
    Friend WithEvents Button10 As Button
    Friend WithEvents Button11 As Button
    Friend WithEvents Button12 As Button
    Friend WithEvents Button13 As Button
    Friend WithEvents Button14 As Button
    Friend WithEvents Button15 As Button
    Friend WithEvents Button16 As Button
    Friend WithEvents Title As Label
    Friend WithEvents Info As Label
    Friend WithEvents Label3 As Label
    Friend WithEvents ProgressBar1 As ProgressBar
    Friend WithEvents Label1 As Label
    Friend WithEvents Button19 As Button
    Friend WithEvents Button20 As Button
    Friend WithEvents Button21 As Button
    Friend WithEvents Button22 As Button
    Friend WithEvents Button23 As Button
    Friend WithEvents Button24 As Button
    Friend WithEvents Button25 As Button
    Friend WithEvents Button26 As Button
    Friend WithEvents Button27 As Button
    Friend WithEvents ButtonExit As Button
End Class

0 个答案:

没有答案