设为首页
收藏本站
开启辅助访问
切换到窄版
登录
立即注册
中问网首页
我的收藏
站长博客
搜索
搜索
本版
帖子
用户
第一问答网
»
论坛
›
中问网
›
问答
›
在线等:在Vb中将数值转换为字符串
返回列表
发新帖
在线等:在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是数组还是函数啊?如果是函数,应该用到等号右侧,如果是数组,换其他名字吧...
回复
使用道具
举报
返回列表
发新帖
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
立即注册
本版积分规则
发表回复
回帖后跳转到最后一页
千问
主题
0
回帖
4882万
积分
论坛元老
论坛元老, 积分 48824836, 距离下一级还需 -38824837 积分
论坛元老, 积分 48824836, 距离下一级还需 -38824837 积分
积分
48824836
加好友
发消息
回复楼主
返回列表
问答
热门排行