Visual_Basic 板


LINE

刚刚下午试着加入绝对值的计算功能 不知道哪里做错了 (不过回圈那边应该没有错,因为没有用绝对值来跑的时候是OK的!!!) === 程式草稿: http://rapidshare.de/files/2358986/AAA.rar.html === Private Sub Command1_Click(Index As Integer) If Option1(0).Value Then Text1.Text = Text1.Text & Index Text5.Text = Text5.Text & Index ElseIf Option1(1).Value Then Text2.Text = Text2.Text & Index ElseIf Option1(2).Value Then Text3.Text = Text3.Text & Index ElseIf Option1(3).Value Then Text4.Text = Text4.Text & Index End If End Sub Private Sub Command10_Click() If Option1(0).Value Then Text1.Text = Text1.Text & Command10.Caption Text5.Text = Text5.Text & Command10.Caption ElseIf Option1(1).Value Then Text2.Text = Text2.Text & Command10.Caption ElseIf Option1(2).Value Then Text3.Text = Text3.Text & Command10.Caption ElseIf Option1(3).Value Then Text4.Text = Text4.Text & Command10.Caption End If End Sub Private Sub Command2_Click(Index As Integer) Text1.Text = Text1.Text & Command2(Index).Caption Text5.Text = Text5.Text & Command2(Index).Caption End Sub Private Sub Command3_Click() Label1.Caption = G(Text1.Text) End Sub Function G(s As String) Dim p As Integer, F As Integer, I As String, J As String Dim a As String, o As String, b As String, u As Integer Static c As Integer: c = c + 1 If c = 1 Then s = Replace(s, " ", "") o = "+": GoSub L20 If p > 0 Then GoSub L40: G = G(I) + G(J): GoTo L10 o = "-": GoSub L20 If p > 0 Then GoSub L40: G = G(I) - G(J): GoTo L10 o = "*": GoSub L20 If p > 0 Then GoSub L40: G = G(I) * G(J): GoTo L10 o = "/": GoSub L20 If p > 0 Then GoSub L40: G = G(I) / G(J): GoTo L10 o = "^": GoSub L20 If p > 0 Then GoSub L40 If I Like "-*" Then G = -G(Mid(I, 2)) ^ G(J) Else G = G(I) ^ G(J) End If GoTo L10 End If o = "Abs": GoSub L30 If p = 0 Then ElseIf p = 1 Then GoSub L50: G = G(I & J) ElseIf p > 1 Then a = Mid(s, p - 1, 1) If a = "+" Then GoSub L60: G = G(I & J) ElseIf a = "-" Then GoSub L70: G = G(I & J) Else GoSub L50: G = G(I & J) End If GoTo L10 End If G = Val(s) L10: c = c - 1: Exit Function L20: p = Len(s) + 1 u = 0 Do Do p = InStrRev(s, o, p - 1) If o = "^" Then Exit Do If p <= 1 Then F = 0 And u = u + 1 Else a = Mid(s, p - 1, 1) If a = "+" Or a = "-" Or a = "*" Or a = "/" Or a = "^" Then F = 1 And u = 0 Else F = 0 And u = u + 1 End If End If Loop While F = 1 If p <= 3 Then F = 0 And u = u + 1: Exit Do Do p = InStrRev(s, o, p - 3) If p <= 3 Then F = 0 And u = u + 1 Else b = Mid(s, p - 3, 3) If b = "Abs" Then F = 1 And u = 0 Else F = 0 And u = u + 1 End If End If Loop While F = 1 Loop While u < 2 If p = 1 Then p = 0 Return L30: p = InStrRev(s, o): Return L40: I = Left(s, p - 1): J = Mid(s, p + 1): Return L50: I = Left(s, p - 1): J = Abs(Val(Mid(s, s + 3))): Return L60: I = Left(s, p - 1): J = Abs(Val(Mid(s, s + 4))): Return L70: I = Left(s, p - 1): J = -Abs(Val(Mid(s, s + 4))): Return End Function Private Sub Command4_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" Label1.Caption = "" End Sub Private Sub Command5_Click() End End Sub Private Sub Command6_Click() If Option1(0).Value Then Text1.Text = Text1.Text + Text2.Text Text5.Text = Text5.Text + "X" Else End If End Sub Private Sub Command7_Click() If Option1(0).Value Then Text1.Text = Text1.Text + Text3.Text Text5.Text = Text5.Text + "Y" Else End If End Sub Private Sub Command8_Click() If Option1(0).Value Then Text1.Text = Text1.Text + Text4.Text Text5.Text = Text5.Text + "Z" Else End If End Sub Private Sub Command9_Click() If Option1(0).Value Then If Len(Text1.Text) >= 1 Then Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1) Text5.Text = Left(Text5.Text, Len(Text5.Text) - 1) Else End If ElseIf Option1(1).Value Then If Len(Text2.Text) >= 1 Then Text2.Text = Left(Text2.Text, Len(Text2.Text) - 1) Else End If ElseIf Option1(2).Value Then If Len(Text3.Text) >= 1 Then Text3.Text = Left(Text3.Text, Len(Text3.Text) - 1) Else End If ElseIf Option1(3).Value Then If Len(Text4.Text) >= 1 Then Text4.Text = Left(Text4.Text, Len(Text4.Text) - 1) Else End If End If End Sub -- 少年读书,如隙中窥月; 中年读书,如庭中望月; 老年读书,如台上玩月。 --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.162.72.67 ※ 编辑: TrueFeeling 来自: 218.162.72.67 (06/14 00:42)
1F:推 fumizuki:Mid(s, s + 3) ?????? 210.58.156.43 06/14







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Gossiping站内搜寻

TOP