在VB 2008梳理盒中进行税收编程 [英] programming in VB 2008 comb box for taxes
问题描述
我是VB 2008的新手.我想从下拉的州中以文本形式显示州税.
I am new to VB 2008. I want to show the state tax in text form from a drop down choice of states.
状态=
Dim decNeb为小数= .0684D
Dim decNeb As Decimal = .0684D
Dim decKan为Decimal = .0645D
Dim decKan As Decimal = .0645D
Dim decIA为小数= .0792D
Dim decIA As Decimal = .0792D
等
选定案例strSelectedState
Selected Case strSelectedState
情况0
strSelected状态= decNebraska
strSelected State = decNebraska
等但什么也没发生
请帮助
推荐答案
您好,
谢谢你的帖子.
Hi,
Thanks for your post.
有多种方法可以做到这一点,在这里我放一个示例
There's various ways to do this, here I put an sample
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ComboBox1.DataSource = GetCurrencyItems()
ComboBox1.DisplayMember = "Name"
ComboBox1.ValueMember = "ValueCurrency"
End Sub
Private Sub ComboBox1_SelectionChangeCommitted(sender As Object, e As System.EventArgs) Handles ComboBox1.SelectionChangeCommitted
MessageBox.Show("Selected Item = : " + ComboBox1.SelectedText.ToString() + " " + ComboBox1.SelectedValue.ToString())
End Sub
Function GetCurrencyItems() As List(Of CurrencyOfWord)
Dim currencyItems = New List(Of CurrencyOfWord)
currencyItems.Add(New CurrencyOfWord(0.0684D, "Neb"))
currencyItems.Add(New CurrencyOfWord(0.0645D, "Kan"))
currencyItems.Add(New CurrencyOfWord(0.0792D, "IA"))
Return currencyItems
End Function
End Class
Public Class CurrencyOfWord
Public Sub New(ByVal ValueCurrency As Decimal, ByVal name As String)
mValueCurrency = ValueCurrency
mName = name
End Sub
Private mValueCurrency As Decimal
Public Property ValueCurrency() As Decimal
Get
Return mValueCurrency
End Get
Set(ByVal ValueCr As Decimal)
mValueCurrency = ValueCr
End Set
End Property
Private mName As String
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal value As String)
mName = value
End Set
End Property
End Class
问候,
罗伯托·博尔赫斯
请记住,如果有帮助,请将其标记为答案;如果没有帮助,则将其取消标记.
Regards,
Roberto Borges
please remember to mark the replies as answers if they help and unmark them if they provide no help.
这篇关于在VB 2008梳理盒中进行税收编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!