Visual Basic检查帐户 [英] Visual Basic Checking Account

查看:67
本文介绍了Visual Basic检查帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编写这个可视化基本表单时遇到了问题。这是一个支票帐户。我有存款和服务费工作,但我没有得到检查工作。我只需要它弹出一条消息说"资金不足:$ 10.00服务费"


公开Class CheckingAccount 
'声明变量
Dim EnterAmountDouble As Double
Dim CurrentBalanceDouble As Double


Private Sub RadioButton3_CheckedChanged(sender as Object,e As EventArgs)Handles radService.CheckedChanged

End Sub

Private Sub Label3_Click(sender As Object,e As EventArgs)处理lblBalance.Click

End Sub

Private Sub Form1_Load(sender As Object,e As EventArgs)Handles MyBase.Load

End Sub

Private Sub btnClear_Click(sender As Object,e As EventArgs )处理btnClear.Click
'清除并重置变量
EnterAmountDouble = 0
CurrentBalanceDouble = 0

'清除并重置文本框
lblBalance.Text = String .Empty
txtAmount.Clear()



End Sub

Private Sub btnCalculate_Click(sender As Object,e As EventArgs)处理btnCalculate.Click
'尝试捕获以确保数字在文本框中

尝试
EnterAmountDouble = Double.Parse(txtAmount.Text)

Catch ex As Exception

MessageBox.Show("必须输入货币ammount","数据错误")
结束尝试

'如果交易类型的Else语句
如果radDeposit.Checked = True那么
CurrentBalanceDouble = CurrentBalanceDouble + EnterAmountDouble
结束如果
如果radCheck.Checked = True那么
CurrentBalanceDouble - = EnterAmountDouble
结束如果
如果radService.Checked = True则
CurrentBalanceDouble - = EnterAmountDouble
结束如果

lblBalance.Text = CurrentBa lanceDouble.ToString(" C")

End Sub

Private Sub btnExit_Click(sender As Object,e As EventArgs)处理btnExit.Click
'关闭form
Me.Close()
End Sub
End Class



解决方案

您好,


如果您对另一种方式持开放态度,请查看我的代码示例。


https://1drv.ms/u/s!AtGAgKKpqdWjh1mgr8hdKx4IVzpt


I'm having problems with coding this visual basic form. It's for a checking account. I got Deposit and Service Charge working but I'm not getting Checking to work. I just need it to pop up a messaging saying "Insufficient Funds: $10.00 Service Charge"

Public Class CheckingAccount
    ' Declare variables
    Dim EnterAmountDouble As Double
    Dim CurrentBalanceDouble As Double


    Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles radService.CheckedChanged

    End Sub

    Private Sub Label3_Click(sender As Object, e As EventArgs) Handles lblBalance.Click

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
        ' Clear and reset variables
        EnterAmountDouble = 0
        CurrentBalanceDouble = 0

        'Clear and reset textboxes
        lblBalance.Text = String.Empty
        txtAmount.Clear()



    End Sub

    Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
        ' Try catch to make sure numbers are in the textbox

        Try
            EnterAmountDouble = Double.Parse(txtAmount.Text)

        Catch ex As Exception

            MessageBox.Show("Must enter a currency ammount", "Data Error")
        End Try

        ' If Else statement for type of transaction
        If radDeposit.Checked = True Then
            CurrentBalanceDouble = CurrentBalanceDouble + EnterAmountDouble
        End If
        If radCheck.Checked = True Then
            CurrentBalanceDouble -= EnterAmountDouble
        End If
        If radService.Checked = True Then
            CurrentBalanceDouble -= EnterAmountDouble
        End If

        lblBalance.Text = CurrentBalanceDouble.ToString("C")

    End Sub

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        ' Close the form
        Me.Close()
    End Sub
End Class


解决方案

Hello,

If you are open to a alternate way look at my code sample.

https://1drv.ms/u/s!AtGAgKKpqdWjh1mgr8hdKx4IVzpt


这篇关于Visual Basic检查帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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