vb.net代码事例的简单介绍
求vb.net的源代码,最好说明其解决问题,越多越好,满意加50分。
下面这段代码,是我用来计算每个月存500元进银行,连续30年,最后连本带利能有多少钱。这里面涉及复利计算。界面中右边的文本框用来输出每一次计算的结果。
成都创新互联公司是一家专注网站建设、网络营销策划、小程序设计、电子商务建设、网络推广、移动互联开发、研究、服务为一体的技术型公司。公司成立十余年以来,已经为近千家纸箱各业的企业公司提供互联网服务。现在,服务的近千家客户与我们一路同行,见证我们的成长;未来,我们一起分享成功的喜悦。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nianxian As Integer '年限变量
Dim dingcun As Integer '定存变量
Dim fuli_big As Long '大复利
Dim fuli_small As Long '小复利
Dim i As Integer '循环变量
Dim DATAstring As String '数据字符串
nianxian = Val(年限_TextBox.Text)
dingcun = Val(定存_TextBox.Text)
DATAstring = ""
For i = 1 To nianxian
fuli_small = dingcun * (1 + 0.1875)
dingcun = fuli_small
fuli_big = fuli_big + fuli_small
DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_big) + Chr(13) + Chr(10)
'DATAstring = DATAstring + "[" + Trim(Str(i)) + "]" + Str(fuli_small) + Chr(13) + Chr(10)
Next
'fuli_big = fuli_small
TextBox1.Text = DATAstring
结果_TextBox.Text = Str(fuli_big) + "元"
End Sub
vb.net 四则运算代码
Dim s1!, s2!, a$ '为小数点的叠加,s1,s2必须定义为单精度型
Dim flag As Boolean 'flag它是过程及的变量,在通用里必须声明
'在数字按钮控件单击数组单击事件中获取操作数(没有区分是哪一个操作数)
Private Sub Command1_Click(Index As Integer)
x = Text1.Text
If flag = True Or x = "0" Then '查看数字是否输入完毕或者是否清零了
Text1.Text = CStr(Index) 'CStr将数值转换字符
Else
Text1.Text = Text1.Text + CStr(Index) '"+"在这里这个是对字符串的操作的叠加,CStr(Index)是接的数据
End If
flag = False '时刻准备数字的输入
End Sub
'2.单击运算符,确定s1,并且要选定运算
Private Sub Command2_Click(Index As Integer)
flag = True
s1 = Val(Text1.Text)
Select Case Index
Case 0
a = "+"
Case 1
a = "-"
Case 2
a = "*"
Case 3
a = "/"
End Select
End Sub
'3."="的单击事件
Private Sub Command3_Click()
flag = True
s2 = Val(Text1.Text)
Select Case a
Case "+"
Text1.Text = s1 + s2
Case "-"
Text1.Text = s1 - s2
Case "*"
Text1.Text = s1 * s2
Case "/"
Text1.Text = s1 / s2 '分母不能为0
End Select
s1 = 0: s2 = 0: a = ""
End Sub
'4.清屏
Private Sub Command4_Click()
Text1.Text = "0"
s1 = 0
s2 = 0
a = ""
flag = False
End Sub
'5.删除最后输入的一个字符,换句话说,将本文框中的字符串取字符(从左往右取left(string,length)),将最后一个字符不取就先行
Private Sub Command5_Click()
If Text1.Text = "" Then
Else
Command5.Enabled = True
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
'len求字符串的长度,left(text1.len(text1)-1减1是取字符串从左往右减去一个字符串
End If
End Sub
'小数点 1)显示出"."(注意前面输入过的整数必须显示) 2)小数后能继续接受数字的输入
Private Sub Command6_Click()
Text1 = Text1 "."
End Sub
'7加入正负号--单击“+、-”,产生一个"-",而且处于一种等待数字输入的一种状态
Private Sub Command7_Click()
Dim temp As Double
temp = -Val(Text1.Text)
Text1.Text = temp
If d = " " Then s1 = temp Else s2 = temp
End Sub
Private Sub Command8_Click() '退出
End
End Sub
Private Sub Form_Load() '窗体初始化
Text1.Text = 0
Text1.Locked = True
End Sub
请教一段VB.net代码?请高手指点下
vb.net采用的GDI+实现图形绘制,不再使用VB6的Print、Line等语句
'改成这样试试
Sub Add(ByVal a As Integer, ByVal b As Integer)
a=a+1
b+b+1
End Sub
分享标题:vb.net代码事例的简单介绍
文章链接:http://ybzwz.com/article/hedeso.html