| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 648 人关注过本帖
标题:(vb6.0)遇到的几个难题
只看楼主 加入收藏
nbatu3065159
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-1-20
结帖率:0
收藏
已结贴  问题点数:20 回复次数:5 
(vb6.0)遇到的几个难题
我是新手 做个简单的程序如下
   有6个textBox  名称分别是text1 text2 text3 text4 text5  text6     
   有1个commandButton    名称是command1
任务1:text1 text2 text3 text4 text5(只能输入2个数字    这个妹子以解决)
任务2:text1 text2 text3 text4 text5(只能输入01——11) 这个不会
任务3:  点一下command1  
If Text1.Text = "03" Then Text6.Text = "01 02 03"
    If Text1.Text = "04" Then Text6.Text = "01 03 04"
    If Text1.Text = "05" Then Text6.Text = "01 04 05   02 03 05"
    If Text1.Text = "06" Then Text6.Text = "01 05 06   02 04 06"
    If Text1.Text = "07" Then Text6.Text = "01 06 07   02 05 07    03 04 07"
    If Text1.Text = "08" Then Text6.Text = "01 07 08   02 06 08    03 05 08"
    If Text1.Text = "09" Then Text6.Text = "01 08 09   02 07 09    03 06 09   04 05 09"
    If Text1.Text = "10" Then Text6.Text = "01 09 10   02 08 10    03 07 10   04 06 10"
    If Text1.Text = "11" Then Text6.Text = "01 10 11   02 09 11    03 08 11   04 07 11   05 06 11"
If Text2.Text = "03" Then Text6.Text = "01 02 03"
    If Text2.Text = "04" Then Text6.Text = "01 03 04"
    If Text2.Text = "05" Then Text6.Text = "01 04 05   02 03 05"
    If Text2.Text = "06" Then Text6.Text = "01 05 06   02 04 06"
    If Text2.Text = "07" Then Text6.Text = "01 06 07   02 05 07    03 04 07"
    If Text2.Text = "08" Then Text6.Text = "01 07 08   02 06 08    03 05 08"
    If Text2.Text = "09" Then Text6.Text = "01 08 09   02 07 09    03 06 09   04 05 09"
    If Text2.Text = "10" Then Text6.Text = "01 09 10   02 08 10    03 07 10   04 06 10"
    If Text2.Text = "11" Then Text6.Text = "01 10 11   02 09 11    03 08 11   04 07 11   05 06 11"
If Text3.Text = "03" Then Text6.Text = "01 02 03"
    If Text3.Text = "04" Then Text6.Text = "01 03 04"
    If Text3.Text = "05" Then Text6.Text = "01 04 05   02 03 05"
    If Text3.Text = "06" Then Text6.Text = "01 05 06   02 04 06"
    If Text3.Text = "07" Then Text6.Text = "01 06 07   02 05 07    03 04 07"
    If Text3.Text = "08" Then Text6.Text = "01 07 08   02 06 08    03 05 08"
    If Text3.Text = "09" Then Text6.Text = "01 08 09   02 07 09    03 06 09   04 05 09"
    If Text3.Text = "10" Then Text6.Text = "01 09 10   02 08 10    03 07 10   04 06 10"
    If Text3.Text = "11" Then Text6.Text = "01 10 11   02 09 11    03 08 11   04 07 11   05 06 11"
If Text5.Text = "03" Then Text6.Text = "01 02 03"
    If Text5.Text = "04" Then Text6.Text = "01 03 04"
    If Text5.Text = "05" Then Text6.Text = "01 04 05   02 03 05"
    If Text5.Text = "06" Then Text6.Text = "01 05 06   02 04 06"
    If Text5.Text = "07" Then Text6.Text = "01 06 07   02 05 07    03 04 07"
    If Text5.Text = "08" Then Text6.Text = "01 07 08   02 06 08    03 05 08"
    If Text5.Text = "09" Then Text6.Text = "01 08 09   02 07 09    03 06 09   04 05 09"
    If Text5.Text = "10" Then Text6.Text = "01 09 10   02 08 10    03 07 10   04 06 10"
    If Text5.Text = "11" Then Text6.Text = "01 10 11   02 09 11    03 08 11   04 07 11   05 06 11"
If Text4.Text = "03" Then Text6.Text = "01 02 03"
    If Text4.Text = "04" Then Text6.Text = "01 03 04"
    If Text4.Text = "05" Then Text6.Text = "01 04 05   02 03 05"
    If Text4.Text = "06" Then Text6.Text = "01 05 06   02 04 06"
    If Text4.Text = "07" Then Text6.Text = "01 06 07   02 05 07    03 04 07"
    If Text4.Text = "08" Then Text6.Text = "01 07 08   02 06 08    03 05 08"
    If Text4.Text = "09" Then Text6.Text = "01 08 09   02 07 09    03 06 09   04 05 09"
    If Text4.Text = "10" Then Text6.Text = "01 09 10   02 08 10    03 07 10   04 06 10"
    If Text4.Text = "11" Then Text6.Text = "01 10 11   02 09 11    03 08 11   04 07 11   05 06 11"
我想做的是点一下command1     text1 text2 text3 text4 text5的结果 都显示在text6.text(未解决)
任务4:   text6  每行只能输入8个字符,多少行不限制(未解决)
以上就是妹子的难题  希望高手给与解决(如果是要微信号 QQ号 手机号的请点关闭)
2015-01-20 13:32
wp231957
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:神界
等 级:贵宾
威 望:423
帖 子:13688
专家分:53332
注 册:2012-10-18
收藏
得分:5 
明明注册的是男士,咋么说是妹子呢

DO IT YOURSELF !
2015-01-20 13:50
lianyicq
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:26
帖 子:737
专家分:3488
注 册:2013-1-26
收藏
得分:5 
主要考虑任务2,任务3的逻辑条件自己考虑。
程序代码:
Option Explicit
Dim state As Integer

Private Sub Form_Load()
Text1.MaxLength = 2
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyBack Then
  If state = 1 Then state = 0
  Exit Sub
End If
If state = 1 And Text1.Text = "0" And KeyAscii > 48 And KeyAscii < 59 Then Exit Sub
If state = 1 And Text1.Text = "1" And (KeyAscii = 48 Or KeyAscii = 49) Then Exit Sub
If Text1.Text = "" And (KeyAscii = 48 Or KeyAscii = 49) Then state = 1: Exit Sub
KeyAscii = 0

End Sub
测试代码,看明白后,有小问题自己思考解决。

大开眼界
2015-01-22 11:38
yangfrancis
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:贵宾
威 望:141
帖 子:1510
专家分:7661
注 册:2014-5-19
收藏
得分:5 
Private Sub Text1_TextChange()
if Len(Text1.text)>2 or Val(Text1.text)>11 or Val(Text1.text)<1 then
   Text1.text="":Text1.SetFocus
end if
End Sub
试一下看行不行
2015-01-22 19:59
yangfrancis
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:贵宾
威 望:141
帖 子:1510
专家分:7661
注 册:2014-5-19
收藏
得分:0 
Text6.Text=Text1.Text+" "+Text2.Text+" "+Text3.Text+Chr(13)+Chr(10)+Text4.Text+" "+Text5.Text
2015-01-22 20:03
工长56
Rank: 2
等 级:论坛游民
帖 子:14
专家分:12
注 册:2015-1-18
收藏
得分:5 
在认真的学习。
2015-01-23 22:19
快速回复:(vb6.0)遇到的几个难题
数据加载中...
 
   



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

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