vb+.net數(shù)組計算器 vb設(shè)計一個簡單的數(shù)字計算器

VB.NET怎么編模擬袖珍計算器的完整程序?

Public C護激篙刻蕻灸戈熏恭抹lass Form1

成都創(chuàng)新互聯(lián)是一家專注于網(wǎng)站設(shè)計、做網(wǎng)站與策劃設(shè)計,乾安網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:乾安等地區(qū)。乾安做網(wǎng)站價格咨詢:028-86922220

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim c As Char

c = Trim(TextBox3.Text)

Select Case c

Case "+"

TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)

Case "-"

TextBox4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)

Case "*"

TextBox4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)

Case "\"

If Val(TextBox2.Text) = 0 Then

MsgBox("分母為0")

Else

TextBox4.Text = Val(TextBox1.Text) \ Val(TextBox2.Text)

End If

Case "/"

If Val(TextBox2.Text) = 0 Then

MsgBox("分母為0")

Else

TextBox4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)

End If

End Select

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

End

End Sub

End Class

如何用vb.net編寫一個簡單的計算器程序???多謝啊

你自己加窗體和空件吧

Private Sub a1_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X + Y

Text3.Text = s

Text3.Locked = True

End Sub

Private Sub a2_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X - Y

Text3.Text = s

Text3.Locked = True

End Sub

Private Sub a3_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X * Y

Text3.Text = s

Text3.Locked = True

End Sub

Private Sub a4_Click()

X = Val(Text1.Text)

Y = Val(Text2.Text)

s = X / Y

Text3.Text = s

Text3.Locked = True

End Sub

不會的叫我 在線談

vb控件數(shù)組制作一個只有加減乘除的簡易計算器

以下是一個簡單的+-*/的計算器代碼,按鈕采用數(shù)組,text2不可見。詳情也可在我的百度空間里查看“vb6 比較簡單的計算器代碼”下載源文件和說明。

Function Eval(ByVal Expressions As String) As String '文本運算vbs

Dim Mssc As Object

Set Mssc = CreateObject("MSScriptControl.ScriptControl")

Mssc.Language = "vbscript"

On Error GoTo EvalErr

Eval = Mssc.Eval(Expressions)

Exit Function

EvalErr:

Exit Function

End Function

Private Sub Command1_Click(Index As Integer)

Dim i As Long, j As Long

For i = 0 To 10 '數(shù)字輸出0-9和小數(shù)點,輸入按鈕的Caption值

If Index = i Then

Text2 = Text2 Command1(i).Caption

Text1 = Format$(Eval(Text2), "0.########") '格式化小于1大于-1的數(shù),下同

End If

Next i

For j = 11 To 14 '運算符號輸出+-*/,輸入按鈕的Caption值

If Index = j Then

Text1 = Format$(Eval(Text2), "0.########")

Text2 = Text1 Command1(j).Caption

End If

Next j

End Sub

如何用vb中控件數(shù)組做一個簡易計算器?

我給你做個簡單的 吧 只做 + - * \ 創(chuàng)建工程后 2個textbox 文本框控件 4個command 按紐控件 1個lalbel 標簽控件 代碼實現(xiàn)如下:

dim a as integer , b as integer, sum as integer

a=text1.text

b=text2.text

Private Sub command1_Click()

sum=a+b

lalbel1.caption=sum

end sub

Private Sub command2_Click()

sum=a-b

lalbel1.caption=sum

end sub

Private Sub command3_Click()

sum=a*b

lalbel1.caption=sum

end sub

Private Sub command4_Click()

sum=a\b

lalbel1.caption=sum

end sub

代碼就這樣 , 按照你的要求寫的 希望給我加分哦

分享標題:vb+.net數(shù)組計算器 vb設(shè)計一個簡單的數(shù)字計算器
鏈接分享:http://muchs.cn/article12/dogisdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、網(wǎng)站設(shè)計公司定制網(wǎng)站、做網(wǎng)站、動態(tài)網(wǎng)站、軟件開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站建設(shè)網(wǎng)站維護公司