❶ 用VB做汇率的问题
从上到下的3个文本框的name为text1,text2,text3.
Private Sub Command1_Click()
Dim usd As Single
Dim rmb As Single
Dim huilv As Single '这是定义的汇率
huilv = Val(Text1.Text)
usd = Val(Text2.Text)
rmb = usd * huilv
Text3.Text = Str(rmb)
End Sub
❷ vb6.0 人民币与美元互相兑换 代码是什么
PrivateSubCommand1_Click()
Text1.Text=Val(Text3.Text)/Val(Text2.Text)
EndSub
PrivateSubCommand2_Click()
Text3.Text=Val(Text1.Text)*Val(Text2.Text)
EndSub
PrivateSubCommand3_Click()
Text3.Text=""
Text1.Text=""
Text2.Text=""
EndSub
PrivateSubCommand4_Click()
End
EndSub
❸ 用vb编写 人民币汇率
保存下面的代码到一个后缀名为FRM的文件中,再用VB打开即可。
============
VERSION 5.00
Begin VB.Form Form1
Caption = "人民币转换工具"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.OptionButton Option1
Caption = "转换成欧元"
Height = 495
Index = 3
Left = 1680
TabIndex = 4
Top = 1200
Width = 1335
End
Begin VB.OptionButton Option1
Caption = "转换成日元"
Height = 495
Index = 2
Left = 240
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.OptionButton Option1
Caption = $"Form2.frx":0000
Height = 495
Index = 1
Left = 1680
TabIndex = 2
Top = 720
Width = 1335
End
Begin VB.OptionButton Option1
Caption = "转换成美元"
Height = 495
Index = 0
Left = 240
TabIndex = 1
Top = 720
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
Left = 240
TabIndex = 0
Top = 120
Width = 1455
End
Begin VB.Label Label1
Height = 375
Left = 480
TabIndex = 5
Top = 1800
Width = 3015
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Option1_Click(Index As Integer)
Dim t As Single
t = Val(Text1.Text)
Label1.Caption = FormatNumber(Choose(Index + 1, t / 7.7, t / 15.47, t / 0.081, t / 10.8), , vbTrue)
End Sub
❹ 怎样用VB编写人民币与美元兑换程序
“美元到人民币”按钮的click事件代码:
my
=
val(text3)
rmb
=
my
*
val(text2)
text1
=
rmb
其中:“兑换比率”输入的是一美元兑换的人民币值
❺ VB编程美元兑换人民币代码
private sub command1_click()
dim m as single,r as single,h as single
m=val(text1.text) '美元数量
h=8.099 '汇率
r=m*h '换算
label1.caption=Format (r, "#.##") '显示兑换的人民币数量
end sub
❻ 用VB编写一款货币转换程序
摆渡知道很廉价,楼上的就不要抱怨了。反正俺只是看看,乐乐罢了。
❼ vb程序 人民币与英镑的转换
dim rmb as single
dim yb as single
dim hl as single'汇率
hl=1/12'汇率,自己设置吧
yb=rmb/hl'英=人民币除以汇率
❽ vb的汇率转换
类型不匹配(错误 13)
当前 Visual Basic为了完成数据类型的赋值,能够对许多数值进行转换,而较早的版本则做不到。然而,此错误仍可能发生并且有几种原因和解决方法。
现在需要搞清楚,这个赋值式是想做字符串拼接还是是数字增加。
❾ vb的汇率转换问题
Label2.Caption & "壹"
....
代码没必要写那么长。用mid的特性,简化代码
❿ 求VB编程:货币兑换,输入人民币,兑换成美元,比例1:8.25
有的地方没说清楚
大概写了下
界面格式如下:
label1 [text1] label2 option1
option2
command1 command2 command3
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
If Option1.Value = True Then
Label1.Caption = "美元币种"
Text1.Text = 8.25 * CDbl(Text1.Text)
End If
If Option2.Value = True Then
Label1.Caption = "港币币种"
Text1.Text = 1.15 * CDbl(Text1.Text)
End If
End Sub
Private Sub Command3_Click()
Text1.SetFocus
Text1.SelLength = (Text1)
End Sub
Private Sub Form_Load()
Command1.Caption = "退出"
Command2.Caption = "兑换"
Command3.Caption = "清除"
Option1.Caption = "美元"
Option2.Caption = "港币"
Label1.Caption = "人民币兑换"
Label2.Caption = "兑换币种"
Option1.Value = True
End Sub