无法转换类型为#System; EventArgs'的对象键入' System.Windows.Forms.KeyPressEventArgs'

时间:2017-02-08 18:01:39

标签: vb.net casting

单击frm.showdialog时,如果在填充的列表视图中单击所需项目,则会发生以下错误:

  

无法转换类型为#System; EventArgs'的对象输入' System.Windows.Forms.KeyPressEventArgs'

Private Sub mnuView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuView.Click
    Dim frm As New frmAllView
    tsStatus.Text = ""
    FormChange(bFormChanged)
    Me.Hide()
    If Not dataMgr.MTDatabase Then
        MessageBox.Show("Enter a record to continue", "No records")
        Me.Show()
    Else
        frm.ShowDialog()  '//--- **error occurs here** ---
        If frm.lvwDisplay.SelectedIndices.Count = 0 Then
            Exit Sub
        Else
            iID = CInt(frm.lvwDisplay.SelectedItems(0).Index)
            NoRecords()
            dataMgr.FindOneName(iID, nc)
            FillBoxes()

        End If
End Sub

0 个答案:

没有答案