求救 VS 2010的Bug ??

 

小弟独自一人用VB.NET的开发Winform程序,有一个BaseListModule控件作为基类控件,然后其他控件作为子类从这个基类继承,可是以前还好好的,最近出现这样一个情况,我不知道该怎么办?博客园大牛多,我想问问有没有人遇到过???目前项目可以正常运行,但是不能设计继承于BaseListModule的类。

这个基类是另外一个项目的类,不知道有关系没??

 

还望大牛给指条明路,我被这个问题困扰了很久了。。。

下面是 BaseListModule 的代码,感觉没啥问题,代码写的比较乱、、、、

 

Public Class BaseListModule
    Inherits BaseModule

    Protected WithEvents _gridView As GridView
    ' 模块的参数,表示显示模块的时候,要按照这个参数来查询记录
    Protected _param As Object

    Public Property GridView() As GridView
        Get
            Return _gridView
        End Get
        Set(ByVal value As GridView)
            _gridView = value
        End Set
    End Property

    Public Sub New()
        ' 此调用是设计器所必需的。
        InitializeComponent()
    End Sub

    Public Sub New(ByVal param As Object)
        Me.New()
        _param = param
    End Sub

    Public Sub AddNewRow(ByVal values() As Object)
        Try
            Dim dt As DataView = _gridView.DataSource
            dt.Table.Rows.Add(values)
            _gridView.RefreshData()
        Catch ex As Exception
            AlertDialog.AlertMsg("添加新行与原表结构不匹配")
        End Try
    End Sub

    ''' <summary>
    ''' View的鼠标按下事件
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Protected Overridable Sub ViewClick(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles _gridView.Click

        Dim _hitInfo As GridHitInfo = _gridView.CalcHitInfo(e.Location)

        If _hitInfo.InRowCell Then
            If e.Button = Windows.Forms.MouseButtons.Right Then
                ShowMenu()
            End If
        End If
    End Sub
    ''' <summary>
    ''' View的鼠标按下事件
    ''' </summary>
    Protected Overridable Sub ViewDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles _gridView.DoubleClick

        Dim _hitInfo As GridHitInfo = _gridView.CalcHitInfo(e.Location)

        If _hitInfo.InRowCell Then

            RowDoubleClick()

        End If
    End Sub

#Region "虚函数"
    Protected Overridable Sub ShowMenu()
        Dim menu As PopupMenu = GetCmsMenu()
        If menu IsNot Nothing Then
            menu.ShowPopup(Control.MousePosition)
        End If
    End Sub

    Protected Overridable Sub RowDoubleClick()

    End Sub
    Protected Overridable Function GetFocusRow() As BaseEntity

    End Function
    ''' <summary>
    ''' 获取子类 菜单
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Overridable Function GetCmsMenu() As PopupMenu

    End Function
    ''' <summary>
    ''' 获取子类查看窗体
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Overridable Function GetCheckForm() As XtraForm

    End Function
    ''' <summary>
    ''' 获取子类查看窗体
    ''' </summary>
    Protected Overridable Function GetCopyForm() As XtraForm

    End Function

    ''' <summary>
    ''' 获取子类添加窗体
    ''' </summary>
    Protected Overridable Function GetAddForm() As XtraForm

    End Function
    ''' <summary>
    ''' 获取子类修改窗体
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Overridable Function GetModifyForm() As XtraForm

    End Function

    Protected Overridable Function GetCheckOperatorForm() As XtraForm

    End Function

    Protected Overridable Function GetManagerForm() As XtraForm

    End Function
    ''' <summary>
    ''' 获取子类其他操作
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Overridable Function GetOperate(ByVal _opType As OperationType) As Boolean

    End Function
    ''' <summary>
    ''' 获取子类操作时的提问字符串
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Protected Overridable Function GetOperatorString(ByVal _opType As OperationType) As String

    End Function

#End Region
    ''' <summary>
    ''' 模块的操作方法
    ''' </summary>
    ''' <param name="_opType"></param>
    ''' <remarks></remarks>
    Public Sub ModuleOpetaror(ByVal _opType As OperationType)
        Dim _form As XtraForm = Nothing
        Select Case _opType
            Case OperationType.CHECK
                _form = GetCheckForm()
            Case OperationType.ADD
                _form = GetAddForm()
            Case OperationType.MODIFY
                _form = GetModifyForm()
            Case OperationType.MANAGER
                _form = GetManagerForm()
            Case OperationType.COPY
                _form = GetCopyForm()
            Case Else
                NoFormOperate(_opType, True)
        End Select

        If _form IsNot Nothing Then
            ShowForm(_form)
        End If

    End Sub

    Protected Sub NoFormOperate(ByVal _opType As OperationType, ByVal needAsk As Boolean)
        Dim askResult As Boolean = True
        If needAsk Then
            If AlertDialog.AlertAskMsg("确定要" + GetOperatorString(_opType) + " ?") Then
                askResult = True
            Else
                askResult = False
            End If
        End If

        If askResult Then
            Dim _message As String = Nothing
            Try
                If GetOperate(_opType) Then
                    Me.ShowModule()
                Else
                    AlertDialog.AlertMsg("操作失败!")
                End If
            Catch ex As SqlException
                Select Case ex.Number
                    Case 547
                        AlertDialog.AlertMsg("不能删除此记录,原因是此记录和其他表中记录有关联关系")
                    Case Else
                        AlertDialog.AlertMsg("操作失败:" + ex.Message)
                End Select
            Catch ex1 As Exception
                AlertDialog.AlertMsg("操作失败:" + ex1.Message)
            End Try
        End If
    End Sub

    ''' <summary>
    ''' 显示那些操作窗体
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ShowForm(ByVal _form As XtraForm)
        Dim result As DialogResult = _form.ShowDialog()
        ShowModule()

        _form.Dispose()
    End Sub
End Class

 

 

posted on 2013-08-15 18:00  敲击人生  阅读(472)  评论(5编辑  收藏  举报

导航