| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 563 人关注过本帖
标题:定义了 MoveType 枚举类型,为何但还是编译错误:用户定义类型未定义?
只看楼主 加入收藏
wlbwxd
Rank: 2
等 级:论坛游民
威 望:1
帖 子:10
专家分:20
注 册:2021-8-9
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:2 
定义了 MoveType 枚举类型,为何但还是编译错误:用户定义类型未定义?
以下是模块代码,显示编译错误,请各位大神帮忙看看问题在哪?
' 移动记录类型的枚举
Public Enum moveType
    FirstRecord = 12
    PreviousRecord = 13
    NextRecord = 14
    LastRecord = 15
End Enum

' 函数名:MoveRecord
' 函数功能:控制表格记录前后移动
' 参数说明:moveType 移动记录类型(使用MoveType枚举)
'           vsf 表格控件
' 返回值:无
Public Sub MoveRecordA(moveType As moveType, ByVal vsf As VSFlexGrid)
    Dim H As Integer
    With vsf
        H = (.Height \ .CellHeight) - 2
        
        Select Case moveType
            Case moveType.FirstRecord
                If .Rows > .FixedRows Then
                    .Row = .FixedRows
                    .TopRow = .FixedRows
                End If
            Case moveType.PreviousRecord
                If .Row > .FixedRows Then
                    .Row = .Row - 1
                    If .Row - .TopRow < 0 Then
                        .TopRow = .TopRow - 1
                    End If
                End If
            Case moveType.NextRecord
                If .Row < .Rows - 1 Then
                    .Row = .Row + 1
                    If .Row - .TopRow > H - 1 Then
                        .TopRow = .TopRow + 1
                    End If
                End If
            Case moveType.LastRecord
                If .Rows > .FixedRows + 1 Then
                    .Row = .Rows - 1
                    If .Rows > H Then
                        .TopRow = .Rows - H
                    End If
                End If
        End Select
        
        ' 处理超出可见范围的情况
        If .Row - .TopRow < 0 Or .Row - .TopRow > H Then
            .TopRow = Abs(.Row - H)
        End If
    End With
End Sub
搜索更多相关主题的帖子: If 类型 Then End Row 
2023-10-28 10:32
apull
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:三体星系
等 级:版主
威 望:216
帖 子:1483
专家分:9055
注 册:2010-3-16
收藏
得分:20 
参数类型和参数名同名了哈。

2023-10-28 12:14
wlbwxd
Rank: 2
等 级:论坛游民
威 望:1
帖 子:10
专家分:20
注 册:2021-8-9
收藏
得分:0 
回复 2楼 apull,修改成这样才正常了
' 移动记录类型的枚举
Public Enum moveType
    FirstRecord = 12
    PreviousRecord = 13
    NextRecord = 14
    LastRecord = 15
End Enum

' 函数名:MoveRecord
' 函数功能:控制表格记录前后移动
' 参数说明:moveType 移动记录类型(使用MoveType枚举)
'           vsf 表格控件
' 返回值:无
Public Sub MoveRecord(ByVal mType As Integer, ByVal vsf As VSFlexGrid)
    Dim H As Integer
    With vsf
        H = (.Height \ .CellHeight) - 2
        
        Select Case mType
            Case moveType.FirstRecord
                If .Rows > .FixedRows Then
                    .Row = .FixedRows
                    .TopRow = .FixedRows
                End If
            Case moveType.PreviousRecord
                If .Row > .FixedRows Then
                    .Row = .Row - 1
                    If .Row - .TopRow < 0 Then
                        .TopRow = .TopRow - 1
                    End If
                End If
            Case moveType.NextRecord
                If .Row < .Rows - 1 Then
                    .Row = .Row + 1
                    If .Row - .TopRow > H - 1 Then
                        .TopRow = .TopRow + 1
                    End If
                End If
            Case moveType.LastRecord
                If .Rows > .FixedRows + 1 Then
                    .Row = .Rows - 1
                    If .Rows > H Then
                        .TopRow = .Rows - H
                    End If
                End If
        End Select
        
        ' 处理超出可见范围的情况
        If .Row - .TopRow < 0 Or .Row - .TopRow > H Then
            .TopRow = Abs(.Row - H)
        End If
    End With
End Sub
2023-10-28 12:37
快速回复:定义了 MoveType 枚举类型,为何但还是编译错误:用户定义类型未定义?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014847 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved