VB 2010没有运行我的整个程序

时间:2014-07-06 23:40:32

标签: visual-studio-2010

过去几周我一直在研究我的VB程序,每个家庭作业都要添加更多内容。直到本周,一切都顺利进行。现在突然,程序显示我的启动画面并跳转到我的关于框,但没有显示我的主要表单。我没有错误,它成功构建并编译。

Public Class Checkbook

    Dim currentBalance As Decimal = CDec(500.0)
    Dim depositAmount As Decimal
    Dim checkAmount As Decimal
    Dim serviceBalance As Decimal
    Dim serviceFee As Decimal
    Dim depositCount As Decimal
    Dim serviceAmount As Decimal
    Dim enteredAmount As Decimal

    Function checkBalance() As Decimal
        'this function allows the user to check their current balance
        Dim enteredAmount As String = transAmount.Text
        serviceFee = 10
        balanceLabel.Text = currentBalance.ToString("C")
        Return currentBalance
    End Function

    Function deposit() As Decimal
        'this function adds the transaction amount to the balance
        enteredAmount = Decimal.Parse(transAmount.Text)
        depositAmount = (currentBalance + enteredAmount)
        currentBalance = depositAmount
        Summary.depositList.Items.Add(depositAmount)
        balanceLabel.Text = currentBalance.ToString("C")
        Return currentBalance
    End Function
    Function check() As Decimal
        'this function takes the check amount and sbutracts its from the balance
        enteredAmount = Decimal.Parse(transAmount.Text)
        checkAmount = (currentBalance - enteredAmount)
        currentBalance = checkAmount
        Summary.amountList.Items.Add(checkAmount)
        Return currentBalance
        'gives a service charge if balance will be negative
        If currentBalance < 0 Then
            currentBalance = currentBalance - 10
            Summary.feesList.Items.Add(serviceFee)
            MessageBox.Show("Negative Balance Fee Applied", "Attention: Fee Incurred")
            Return currentBalance
        End If
    End Function
    Function service() As Decimal
        'this transaction subtracts the service charge from the balance
        enteredAmount = Decimal.Parse(transAmount.Text)
        serviceAmount = (currentBalance - (10 + enteredAmount))
        currentBalance = serviceAmount
        Summary.amountList.Items.Add(serviceAmount)
        balanceLabel.Text = currentBalance.ToString
        Return currentBalance
    End Function



    Private Sub ExitToolStripMenuItem_Click(sender As Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        'exits form
        Me.Close()
    End Sub

    Private Sub AboutToolStripMenuItem_Click(sender As Object, e As System.EventArgs) Handles AboutToolStripMenuItem.Click
        'gives information about program
        AboutBox.Show()
    End Sub

    Private Sub SummaryToolStripMenuItem_Click(sender As Object, e As System.EventArgs) Handles SummaryToolStripMenuItem.Click
        'shows summary of transactions
        Summary.Show()
    End Sub

    Private Sub CalculateToolStripMenuItem_Click(sender As Object, e As System.EventArgs) Handles CalculateToolStripMenuItem.Click
        'gives orders for what function to call
        If balanceButton.Checked Then
            Call checkBalance()
        ElseIf checkButton.Checked Then
            Call check()
        ElseIf depositButton.Checked Then
            Call deposit()
        ElseIf serviceRadioButton.Checked Then
            Call service()

        End If
    End Sub

    Private Sub FontToolStripMenuItem_Click(sender As Object, e As System.EventArgs) Handles FontToolStripMenuItem.Click
        'allows user to change font type and size
        With FontDialog1
            .Font = balanceLabel.Font
            .ShowDialog()
            balanceLabel.Font = .Font

        End With
    End Sub

    Private Sub ColorToolStripMenuItem_Click(sender As Object, e As System.EventArgs) Handles ColorToolStripMenuItem.Click
        'allows user to change font color
        With ColorDialog1
            .Color = balanceLabel.ForeColor
            .ShowDialog()
            balanceLabel.ForeColor = .Color

        End With
    End Sub
End Class

1 个答案:

答案 0 :(得分:0)

  

我的启动画面打开然后运行,而不是运行我的实际程序表单,它会拉出我的关于表单

听起来你的About表单是应用程序首次运行时设置为启动的默认表单。在代码中的某处有一个static void Main方法。该方法应该具有打开第一个表单的代码。它可能是这样的:

Application.Run(new AboutForm());

您可能希望将其更改为所需的格式:

Application.Run(new SomeOtherForm());