vb.net界面代码设计,vb界面介绍
用VB.NET程序编写代码
Delphi代码如下:
网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、小程序制作、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了英山免费建站欢迎大家使用!
procedure TForm1.Button1Click(Sender: TObject);
var
购物总价:Integer;
折扣:Extended;
begin
购物总价:=StrToInt(Edit1.Text);
if 购物总价250 then
begin
折扣:=0;
end
else if 购物总价500 then
begin
折扣:=0.05;
end
else if 购物总价1000 then
begin
折扣:=0.075;
end
else if 购物总价2000 then
begin
折扣:=0.1;
end
{
此段的折扣是多少?
else if 购物总价3000 then
begin
折扣:=0.05;
end
}
else if 购物总价=3000 then
begin
折扣:=0.15;
end;
ShowMessage('您享受的折扣是:'+FloatToStr(折扣)
+' 原价:'+IntToStr(购物总价)
+' 折后总价:'+FloatToStr(购物总价*(1-折扣)));
end;
vb.net界面设计
可以先把外层的目录新建出来,代码如下:
Dim path As String
path = "c:\text\text\txt\text1.txt"
System.IO.Directory.CreateDirectory(path.Substring(0, InStrRev(path, "\"))) '建立path这个路径的所有所需目录
System.IO.File.WriteAllText(path, "牛年快乐", System.Text.Encoding.Default)
用vb.net编写程序 修改和界面设计
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aa As Integer = Val(TextBox1.Text)
Dim i As Integer
For i = 2 To aa
If aa Mod i = 0 Then
TextBox2.Text += i.ToString + " "
aa = aa / i
i = 2
End If
Next
End Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = ss()
TextBox2.Text = ss()
End Sub
Function ss()
Randomize()
Dim a As Integer = Int(Rnd() * 100)
Return a
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Val(TextBox1.Text) + Val(TextBox2.Text) = Val(TextBox3.Text) Then
i += 1
Label3.Text = "正确"
Else
j += 1
Label3.Text = "错误"
End If
aa += 1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ss()
TextBox2.Text = ss()
TextBox3.Text = ""
Label3.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox4.Text = "你已经答了" + aa.ToString + "题,答对" + i.ToString + "题," + "答错" + j.ToString + "题。"
End Sub
网站栏目:vb.net界面代码设计,vb界面介绍
网站路径:http://ybzwz.com/article/hsjegj.html