在线等:在Vb中将数值转换为字符串

[复制链接]
查看11 | 回复2 | 2009-1-25 13:55:08 | 显示全部楼层 |阅读模式
程序的部分代码
Private Sub Command1_Click()
a = Str$(Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text))
b = Str$(Val(Text7.Text) + Val(Text8.Text) + Val(Text9.Text) + Val(Text10.Text) + Val(Text11.Text) + Val(Text12.Text))
c = Str$(Val(Text13.Text) + Val(Text14.Text) + Val(Text15.Text) + Val(Text16.Text) + Val(Text17.Text) + Val(Text18.Text))
a = Str$(Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text))
b = Str$(Val(Text7.Text) + Val(Text8.Text) + Val(Text9.Text) + Val(Text10.Text) + Val(Text11.Text) + Val(Text12.Text))
c = Str$(Val(Text13.Text) + Val(Text14.Text) + Val(Text15.Text) + Val(Text16.Text) + Val(Text17.Text) + Val(Text18.Text))
Right(a, 1) = a
Right(b, 1) = b
Right(c, 1) = c
`就是这里出的错
End Sub
是不是应该把abc转换为字符串?那怎么转换呢?
我是菜鸟……
我是想取和(a、b、c)的个位数,也就是右面1位

回复

使用道具 举报

千问 | 2009-1-25 13:55:08 | 显示全部楼层
a=Right(a, 1) b=Right(b, 1) c=Right(c, 1)例如:dim a as stringdim b as stringa=Str$(5)b=Str$(1)a=b+a'a="15"print "个位是:" & right(a,1) '5...
回复

使用道具 举报

千问 | 2009-1-25 13:55:08 | 显示全部楼层
Right(a, 1) = a 这句里的Right是数组还是函数啊?如果是函数,应该用到等号右侧,如果是数组,换其他名字吧...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行