Option严格禁止后期绑定

时间:2017-12-17 16:49:03

标签: vb.net binding class-library

Private Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click
    Dim coinnn As New Coin()

    ' decalres variables and link them to the class library
    coinnnn.Metal.Silver = "Silver"
    coinnnn.Metal.Platinum = "Platinum"
    coinnnn.Metal.Palladium = "Palladium"
    coinnnn.Metal.Zinc = "Zinc"
    coinnnn.Metal.Nickel = "Nickel"
    coinnnn.Metal.Platinum = "Platinum"
    coinnnn.Metal.Gold = "Gold"
    coinnnn.Metal.Copper = "Copper"
    coinnnn.Currency.USD = "USD"
    coinnnn.Currency.JPY = "JPY"
    coinnnn.Currency.CHF = "CHF"
    coinnnn.Currency.CAD = "CAD"
    coinnnn.Currency.EUR = "EUR"
    coinnnn.Currency.GBP = "GBP"

    ' adds the values to the radio boxes
    If radZinc.Checked Then
        radZinc = coinnnn.Metal.Zinc
        If radSilver.Checked Then
            radSilver = coinnnn.Metal.Silver
        ElseIf radPlatinum.Checked Then
            radPlatinum = coinnnn.Metal.Platinum
            If radPalladium.Checked Then
                radPalladium = coinnnn.Metal.Palladium
                If radNickel.Checked Then
                    radNickel = coinnnn.Metal.Nickel
                ElseIf radGold.Checked Then
                    radGold = coinnnn.Metal.Gold
                    If radCopper.Checked Then
                        radCopper = coinnnn.Metal.Copper
                    End If
                End If
            End If
        End If
    End If

    ' adds the values to the drop-down list
    If cboCurrency.SelectedValue.USD Then
        cboCurrency = coinnnn.Currency.USD
        If cboCurrency.SelectedValue.EUR Then
            cboCurrency = coinnnn.Currency.EUR
        ElseIf cboCurrency.SelectedValue.GBP Then
            cboCurrency = coinnnn.SelectedValue.GBP
            If cboCurrency.SelectedValue.JPY Then
                cboCurrency = coinnnn.Currency.JPY
                If cboCurrency.SelectedValue.CHF Then
                    cboCurrency = coinnnn.Currency.CHF
                ElseIf cboCurrency.SelectedValue.CAD Then
                    cboCurrency = coinnnn.Currency.CAD
                End If
            End If
        End If
    End If

End Sub

我正在使用类库,我不断收到错误选项严格禁止后期绑定。需要帮助完成这项学校作业。谢谢。

1 个答案:

答案 0 :(得分:0)

经过大量研究后我发现我的类库没有正确引用,我不得不通过下载更新来修复visual studio,然后我重新构建了类库并再次引用它。现在它引用它。我创建了一个for Each循环,现在将弄清楚如何通过组合框获取用户从类库中选择的项目列表。