标题:VSFlexGrid二级联动下拉框的问题,求助
取消只看楼主
taking168
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2018-8-13
结帖率:50%
已结贴  问题点数:20 回复次数:1 
VSFlexGrid二级联动下拉框的问题,求助


我在VSFlexGrid1里做了两个下拉联动的选择框,现在的问题是前面的第一列没有记录的时候第二列也会出现第一个单元格联动的数据,这个代码该怎么修改呀,我只想第一列不为空第二列才显示和第一列相对应的记录,下面是代码
Private Sub Form_Load()
Dim i As Integer
Me.VSFlexGrid1.Cols = 11 'áD
Me.VSFlexGrid1.Rows = 10 'DD
Me.VSFlexGrid1.FixedCols = 1
Me.VSFlexGrid1.FixedRows = 1
For i = 0 To Me.VSFlexGrid1.Rows - 1
    Me.VSFlexGrid1.RowHeight(i) = 350
Next

    'Me.VSFlexGrid1.ColComboList(0) = "..."
    'Me.VSFlexGrid1.CellButtonPicture = Me.ImageList1.ListImages(1).Picture

Me.VSFlexGrid1.ColWidth(0) = 600
Me.VSFlexGrid1.ColWidth(1) = 2500
Me.VSFlexGrid1.ColWidth(2) = 2500
Me.VSFlexGrid1.ColWidth(3) = 800
Me.VSFlexGrid1.ColWidth(4) = 1000
Me.VSFlexGrid1.ColWidth(5) = 800
Me.VSFlexGrid1.ColWidth(6) = 1000
Me.VSFlexGrid1.ColWidth(7) = 1000
Me.VSFlexGrid1.ColWidth(8) = 1000
Me.VSFlexGrid1.ColWidth(9) = 1000
Me.VSFlexGrid1.ColWidth(10) = 1500

Me.VSFlexGrid1.TextMatrix(0, 0) = "DòoÅ"
Me.VSFlexGrid1.TextMatrix(0, 1) = "é豸Ãû3Æ"
Me.VSFlexGrid1.TextMatrix(0, 2) = "é豸DíoÅ"
Me.VSFlexGrid1.TextMatrix(0, 3) = "μ¥λ"
Me.VSFlexGrid1.TextMatrix(0, 4) = "μ¥¼Û"
Me.VSFlexGrid1.TextMatrix(0, 5) = "êyá¿"
Me.VSFlexGrid1.TextMatrix(0, 6) = "μ¥¼ÛoϼÆ"
Me.VSFlexGrid1.TextMatrix(0, 7) = "°2×°·ÑóÃ"
Me.VSFlexGrid1.TextMatrix(0, 8) = "¿ØÖÆÆ÷"
Me.VSFlexGrid1.TextMatrix(0, 9) = "ÆäËû·ÑóÃ"
Me.VSFlexGrid1.TextMatrix(0, 10) = "oϼÆ"


Call OpenConn
     Sql = "select DISTINCT é豸Ãû3Æ from ¸ñá|é豸Ãû3Ʊí"
     Rs.Open Sql, Cn, 1, 1
     Do While Not Rs.EOF
        Me.VSFlexGrid1.ColComboList(1) = Me.VSFlexGrid1.BuildComboList(Rs, "é豸Ãû3Æ")
        Rs.MoveNext
     Loop
Call CloseConn

End Sub

Private Sub VSFlexGrid1_Click()
If Me.VSFlexGrid1.TextMatrix(RowSel, 1) = "" Then Exit Sub
Call OpenConn
     Sql = "select DISTINCT é豸DíoÅ from ¸ñá|é豸Díoűí where é豸Ãû3Æ='" & Me.VSFlexGrid1.TextMatrix(Me.VSFlexGrid1.Row, 1) & "'"
     Rs.Open Sql, Cn, 1, 1
Do While Not Rs.EOF
     Me.VSFlexGrid1.ColComboList(2) = Me.VSFlexGrid1.BuildComboList(Rs, "é豸DíoÅ")
     Rs.MoveNext
Loop
Call CloseConn

End Sub
搜索更多相关主题的帖子: 联动 Sql Sub Call 一列 
2021-10-07 21:23
taking168
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2018-8-13
得分:0 
回复 2楼 约定的童话
怎么去空呀是 &“”这样吗?
2021-10-08 21:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-507070-1-1.html




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

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