下面這段代碼,是我用來(lái)計(jì)算每個(gè)月存500元進(jìn)銀行,連續(xù)30年,最后連本帶利能有多少錢。這里面涉及復(fù)利計(jì)算。界面中右邊的文本框用來(lái)輸出每一次計(jì)算的結(jié)果。
成都創(chuàng)新互聯(lián)專注于淳安網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠(chéng)為您提供淳安營(yíng)銷型網(wǎng)站建設(shè),淳安網(wǎng)站制作、淳安網(wǎng)頁(yè)設(shè)計(jì)、淳安網(wǎng)站官網(wǎng)定制、成都小程序開(kāi)發(fā)服務(wù),打造淳安網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供淳安網(wǎng)站排名全網(wǎng)營(yíng)銷落地服務(wù)。
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 '大復(fù)利
? Dim fuli_small As Long '小復(fù)利
? Dim i As Integer '循環(huán)變量
? Dim DATAstring As String '數(shù)據(jù)字符串
? 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
? 結(jié)果_TextBox.Text = Str(fuli_big) + "元"
End Sub
使用webbrowser控件來(lái)加載網(wǎng)頁(yè),然后再
Private
Sub
WebBrowser
1_DocumentCompleted下通過(guò)使用WebBrowser1.Document.Body.
InnerHtml
來(lái)獲取網(wǎng)頁(yè)的源代碼,或使用
WebBrowser1.Document.Body.InnerText來(lái)獲取網(wǎng)頁(yè)中的文本。之后可以通過(guò)字符串控制指令或者
正則表達(dá)式
來(lái)精確獲取到你所需的數(shù)據(jù)。
Dim url As String=" 網(wǎng)址"
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 獲取或設(shè)置一個(gè)值,該值指示是否與
Internet資源建立持久連接。
Dim reader As StreamReader = _
New StreamReader(httpResp.GetResponseStream,
System.Text.Encoding.GetEncoding(-0))
Dim respHTML As String = reader.ReadToEnd() 'respHTML就是網(wǎng)頁(yè)源代碼