これは些細なことでなければなりません。私はこれを生計のために行っていますが、なぜこの例外が発生するのか理解できません。
System.NullReferenceExceptionが未処理でしたMessage=オブジェクト参照がオブジェクトのインスタンスに設定されていません。
コードは次のとおりです。
Public Class frmMain
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim counties() As String
counties = {"", "Huntsville, AL", "Madison, AL", "Rural Madison County, AL", "Taft, TN"}
Me.cbCounties.DataSource = counties
Me.lblStatus.Text = "[ Please select a county ]"
Me.lblStatus.Left = Me.ClientSize.Width \ 2 - Me.lblStatus.Width \ 2
End Sub
Private Sub cbCounties_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbCounties.SelectedIndexChanged
Select Case cbCounties.SelectedIndex
Case 1
txtTaxRate.Text = "8.00%" 'Issue is these, when index is changed.
Case 2
txtTaxRate.Text = "8.50%"
Case 3
txtTaxRate.Text = "5.50"
Case 4
txtTaxRate.Text = "9.50%"
Case Else
txtTaxRate.Text = Nothing
End Select
Me.lblStatus.Text = "[ Please enter net amount ]"
Me.lblStatus.Left = Me.ClientSize.Width \ 2 - Me.lblStatus.Width \ 2
End Sub
エンドクラス
ヘルプ?