浆糊论坛-RO小站's Archiver

liuhlightning 发表于 2007-12-15 10:57

【VB】学过那么一点点编程的都进来帮帮忙

当M=0 N<>0 O<>0 P<>0时给LABEL1.CAPTION赋值1
当M=0 N=0 O=0 P=0时给LABEL1.CAPTION赋值2
当M<>0时给LABEL1.CAPTION赋值3
这个应该怎么写。

黑龍 发表于 2007-12-15 11:02

做SF...观望....

liuhlightning 发表于 2007-12-15 11:02

[quote]原帖由 [i]黑龍[/i] 于 2007-12-15 11:02 AM 发表 [url=http://bbs.rohome.net/redirect.php?goto=findpost&pid=8613224&ptid=861376][img]http://bbs.rohome.net/images/common/back.gif[/img][/url]
做SF...观望.... [/quote]
我不想说的:我操你大爷的!

飞雪の轨迹 发表于 2007-12-15 11:06

:ph34r: 我学C的,完全不一样啊

liuhlightning 发表于 2007-12-15 11:19

[quote]原帖由 [i]飞雪の轨迹[/i] 于 2007-12-15 11:06 AM 发表 [url=http://bbs.rohome.net/redirect.php?goto=findpost&pid=8613244&ptid=861376][img]http://bbs.rohome.net/images/common/back.gif[/img][/url]
:ph34r: 我学C的,完全不一样啊 [/quote]
其实我知道是用IF+ELSEIF+ELSE语句解决问题,但是写出来的就是不对.............................

与星独白 发表于 2007-12-15 12:57

[quote]原帖由 [i]liuhlightning[/i] 于 2007-12-15 11:19 发表 [url=http://bbs.rohome.net/redirect.php?goto=findpost&pid=8613288&ptid=861376][img]http://bbs.rohome.net/images/common/back.gif[/img][/url]

其实我知道是用IF+ELSEIF+ELSE语句解决问题,但是写出来的就是不对............................. [/quote]
...

直接用if就可以了  不要else了

这样就可以了
[quote]if M=0 and N<>0 and O<>0 and P<>0 then
LABEL1.CAPTION=1
end if
if M=0 and N=0 and O=0 and P=0 then
LABEL1.CAPTION=2
end if
if M<>0 then
LABEL1.CAPTION=3
end if
end[/quote]

[[i] 本帖最后由 与星独白 于 2007-12-15 13:03 编辑 [/i]]

蜡烛鞭三郎 发表于 2007-12-15 13:40

当M=0 N<>0 O<>0 P<>0时给LABEL1.CAPTION赋值1
当M=0 N=0 O=0 P=0时给LABEL1.CAPTION赋值2
当M<>0时给LABEL1.CAPTION赋值3


If M=0 Then
    If N<>0 Then
          If O <> 0 and P<>0 Then
               LABEL1.Caption=1
          End If
    ElseIf N=0 Then
          If O=0 and P=0 Then
                LABEL1.Caption=2
          End If
    End If
Else
    LABEL1.Caption=3
End If

[[i] 本帖最后由 蜡烛鞭三郎 于 2007-12-15 13:42 编辑 [/i]]

神医【曲席瑞】 发表于 2007-12-15 14:02

高中学编程的

liuhlightning 发表于 2007-12-15 18:11

[quote]原帖由 [i]蜡烛鞭三郎[/i] 于 2007-12-15 01:40 PM 发表 [url=http://bbs.rohome.net/redirect.php?goto=findpost&pid=8613719&ptid=861376][img]http://bbs.rohome.net/images/common/back.gif[/img][/url]
当M=0 N0 O0 P0时给LABEL1.CAPTION赋值1
当M=0 N=0 O=0 P=0时给LABEL1.CAPTION赋值2
当M0时给LABEL1.CAPTION赋值3


If M=0 Then
    If N0 Then
          If O  0 and P0 Then
               L ... [/quote]
还是有问题。难道是我用错变量了?single没问题的啊。

[[i] 本帖最后由 liuhlightning 于 2007-12-15 18:13 编辑 [/i]]

蜡烛鞭三郎 发表于 2007-12-15 22:43

你吧程序给我算了 我改完还你..

与星独白 发表于 2007-12-15 23:01

[quote]原帖由 [i]liuhlightning[/i] 于 2007-12-15 18:11 发表 [url=http://bbs.rohome.net/redirect.php?goto=findpost&pid=8614420&ptid=861376][img]http://bbs.rohome.net/images/common/back.gif[/img][/url]

还是有问题。难道是我用错变量了?single没问题的啊。 [/quote]

用我那个试试

小明打小白 发表于 2007-12-16 01:09

if M<>0 then
  label1.caption = 3
    elseif n=0 and o=0 p=0 then
       label1.caption = 2
          else
             label1.caption =1
end if

蜡烛鞭三郎 发表于 2007-12-16 02:03

[quote]原帖由 [i]小明打小白[/i] 于 2007-12-16 01:09 发表 [url=http://bbs.rohome.net/redirect.php?goto=findpost&pid=8615812&ptid=861376][img]http://bbs.rohome.net/images/common/back.gif[/img][/url]
if M0 then
  label1.caption = 3
    elseif n=0 and o=0 p=0 then
       label1.caption = 2
          else
             label1.caption =1
end if [/quote]


if M=0 then
  label1.caption = 3
    elseif n=0 and o=0 and p=0 then
       label1.caption = 2
          elseif n<>0 and o<>0 and p<>0
             label1.caption =1
end if

这样写吧

春仔 发表于 2007-12-16 08:35

学过也忘记了。。。我大1学的
















现在大1。。

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.