Private Sub RichTextView_TextChanged(ByVal sender As Object, ByVal e As
KeyPressEventArgs) Handles RichTextView.KeyPress, RichTextView.TextChanged
Dim c As Char = e.KeyChar
Dim i As Integer = Asc(c)
Dim h As Char = Chr(i)
capitalise_first_letter.Add(h)
End Sub
上記のコードはエラーを生成します:Unable to cast object of type 'System.EventArgs' to type 'System.Windows.Forms.KeyPressEventArgs'.
エラーをスローしますcapitalise_first_letter.Add(h)
(capitalise_first_letter は文字列のリストです)。
なんで?h は e.KeyChar であるため、変換が行われますか?