| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 585 人关注过本帖
标题:这种表格的数据该如何查询
只看楼主 加入收藏
lzb3158
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2014-5-21
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:3 
这种表格的数据该如何查询
想用VB做一个交叉表格的查询,有点类似密保卡查询那样 竖起的有50行与横起的有16列,在text1里输入竖起的48,然后又在text2里输入2.0,然后就在text3里显示89.图片如下。我是个VB小白,请老师们多指教。最好附上源码。
图片附件: 游客没有浏览图片的权限,请 登录注册


[ 本帖最后由 lzb3158 于 2015-1-18 15:53 编辑 ]
搜索更多相关主题的帖子: 最好 如何 图片 
2015-01-18 15:47
sj476606729
Rank: 2
等 级:论坛游民
威 望:1
帖 子:8
专家分:38
注 册:2015-1-17
收藏
得分:10 
用二维数组很简单,直接找到数值
2015-01-18 17:46
lzb3158
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2014-5-21
收藏
得分:0 
回复 2楼 sj476606729
请详解。
2015-01-18 21:22
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4947
专家分:30084
注 册:2008-10-15
收藏
得分:10 
Option Explicit

Dim d(7, 7) As String                '防止出现字母。

Private Sub Command1_Click()
Dim i As Long, j As Long
For i = 0 To 7
    If d(0, i) = Text1.Text Then
        Exit For
    End If
Next i
For j = 0 To 7
    If d(j, 0) = Text2.Text Then
        Exit For
    End If
Next j

If i > 0 And j > 0 And i < 8 And j < 8 Then
    Text3.Text = d(j, i)
End If
End Sub

Private Sub Form_Load()
d(0, 0) = "0"
d(0, 1) = "50"
d(0, 2) = "49"
d(0, 3) = "48"
d(0, 4) = "47"
d(0, 5) = "46"
d(0, 6) = "45"
d(0, 7) = "44"
d(1, 0) = "0.5"
d(1, 1) = "97"
d(1, 2) = "97"
d(1, 3) = "97"
d(1, 4) = "97"
d(1, 5) = "97"
d(1, 6) = "97"
d(1, 7) = "97"
d(2, 0) = "1.0"
d(2, 1) = "94"
d(2, 2) = "94"
d(2, 3) = "94"
d(2, 4) = "94"
d(2, 5) = "94"
d(2, 6) = "94"
d(2, 7) = "94"
d(3, 0) = "1.5"
d(3, 1) = "92"
d(3, 2) = "92"
d(3, 3) = "92"
d(3, 4) = "92"
d(3, 5) = "91"
d(3, 6) = "91"
d(3, 7) = "91"
d(4, 0) = "2.0"
d(4, 1) = "89"
d(4, 2) = "89"
d(4, 3) = "89"
d(4, 4) = "89"
d(4, 5) = "89"
d(4, 6) = "88"
d(4, 7) = "88"
d(5, 0) = "2.5"
d(5, 1) = "87"
d(5, 2) = "86"
d(5, 3) = "86"
d(5, 4) = "86"
d(5, 5) = "86"
d(5, 6) = "86"
d(5, 7) = "86"
d(6, 0) = "3.0"
d(6, 1) = "84"
d(6, 2) = "84"
d(6, 3) = "84"
d(6, 4) = "83"
d(6, 5) = "83"
d(6, 6) = "83"
d(6, 7) = "83"
d(7, 0) = "3.5"
d(7, 1) = "82"
d(7, 2) = "81"
d(7, 3) = "81"
d(7, 4) = "81"
d(7, 5) = "81"
d(7, 6) = "80"
d(7, 7) = "80"
End Sub

授人于鱼,不如授人于渔
早已停用QQ了
2015-01-19 09:06
快速回复:这种表格的数据该如何查询
数据加载中...
 
   



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

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