51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1937|回复: 2
打印 上一主题 下一主题

[求助] VBS怎么判断表元是合并表元?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-7-24 12:13:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
VBS怎么判断表元是合并表元?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2009-7-24 12:19:23 | 只看该作者

我搜的,看能不能给你提个醒

我最近写的DataGrid合并/删除相同列通用函数,跟大家分享 鉴于相当多页面都要做合并列,我最近写了DataGrid合并/删除相同列通用函数,跟大家分享。
    Public Shared Sub DBGridSpanCell(ByRef dgdData As DataGrid, _
                                     ByVal intColumnItem As Integer, _
                                     ByVal intColumnStart As Integer, _
                                     ByVal intColumnEnd As Integer, _
                                     Optional ByVal intSpan As Integer = 2)
        '名称:DBGridSpanCell
        '功能:合并/删除相同的项目名
        '作者:dzt
        '创建:2004/1/1
        '修改:2004/1/1
        '参数:dgdData:DataGrid对象
        '      intColumnItem:要合并列
        '      intColumnStart:合并起始列
        '      intColumnEnd:合并结束列
        '      intSpan:跨行数
        '返回:成功,True,反之,False
        '说明:

        Dim i As Integer
        Dim o_intCols As Integer
        Dim iSpan As Integer = intSpan '跨行数
        Dim iRow As Integer = 0 '开始的跨行
        Dim sItem As String
        Dim sColumnText As String
        Dim ColumnType As Type
        Dim ctl As System.Web.UI.Control

        With dgdData.Items
            For i = 0 To .Count - 1
                With .Item(i)
                    ColumnType = dgdData.Columns(intColumnItem).GetType
                    '模板列,label
                    If ColumnType Is GetType(TemplateColumn) Then
                        For Each ctl In dgdData.Items(i).Cells(intColumnItem).Controls
                            If ctl.GetType Is GetType(Label) Then
                                sColumnText = CType(ctl, Label).Text
                                Exit For
                            End If
                        Next
                    Else
                        sColumnText = .Cells(intColumnItem).Text
                    End If

                    ' If .Cells(intColumnItem).Text = sItem Then
                    If sColumnText = sItem Then
                        For o_intCols = intColumnStart To intColumnEnd
                            dgdData.Items(iRow).Cells(o_intCols).RowSpan = iSpan
                            .Cells(o_intCols).Visible = False
                        Next

                        iSpan += 1
                    Else
                        iRow = i
                        iSpan = intSpan
                        'sItem = .Cells(intColumnItem).Text
                        sItem = sColumnText
                    End If
                End With
            Next
        End With
    End Sub
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2009-8-11 16:30:03 | 只看该作者
学习,学习
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-29 11:39 , Processed in 0.103005 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表