资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb点虐 实现计算器的简单介绍

怎样在VB .NET中调用记事本和计算器

这个啊,呵呵,应该不难吧

10年积累的成都做网站、成都网站建设、成都外贸网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站制作后付款的网站建设流程,更有大邑县免费网站建设让你可以放心的选择与我们合作。

先找到你要打开的应用程序的文件

然后用一个调用代码:

System.Diagnostics.Process.Start("C:\WINDOWS\system32\notepad.exe")

这是要枯高前开记事本的

System.Diagnostics.Process.Start("C:\WINDOWS\system32\calc.exe")

这是打开计算器的

应念塌该也可以把这两个应用程序复制到你的程序的默认目录下,就是BIN下吧!

呵呵,试没清试!!要给我加分哦!!!

VB.NET怎么编模拟袖珍计算器的完整程序?

Public C护激篙刻蕻灸戈熏让贺恭抹lass Form1

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:简易计算器(加减乘除)代码

代码如下:

Dim t, t1 As Integer

Dim x, y As Double

Public Sub com()

x = Val(l1.Caption)

Select Case t1

Case Is = 1: y = y + x

Case Is = 2: y = y - x

Case Is = 3: y = y * x

Case Is = 4: y = y / x

End Select

t1 = 0

t = 0

l1.Caption = "0"

End Sub

Private Sub Form_Load()

x = 0

y = 0

t = 0

t1 = 1

End Sub

Private Sub c0_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "0"

Else

l1.Caption = l1.Caption + "0"

End If

End Sub

Private Sub C1_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "1"

Else

l1.Caption = l1.Caption + "1"

End If

End Sub

Private Sub c10_Click(Index As Integer)

If t = 0 Then

l1.Caption = l1.Caption + "."弊含

t = 1

End If

End Sub

Private Sub C2_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "2"

Else

l1.Caption = l1.Caption + "租卖笑2"

End If

End Sub

Private Sub C3_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "3"

Else

l1.Caption = l1.Caption + "3"

End If

End Sub

Private Sub C4_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "4"

Else

l1.Caption = l1.Caption + "4"

End If

End Sub

Private Sub C5_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "5"

Else

l1.Caption = l1.Caption + "5"

End If

End Sub

Private Sub C6_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "配尘6"

Else

l1.Caption = l1.Caption + "6"

End If

End Sub

Private Sub C7_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "7"

Else

l1.Caption = l1.Caption + "7"

End If

End Sub

Private Sub C8_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "8"

Else

l1.Caption = l1.Caption + "8"

End If

End Sub

Private Sub C9_Click(Index As Integer)

If l1.Caption = "0" Then

l1.Caption = "9"

Else

l1.Caption = l1.Caption + "9"

End If

End Sub

Private Sub z1_Click(Index As Integer)

com

t1 = 1

End Sub

Private Sub z2_Click(Index As Integer)

com

t1 = 2

End Sub

Private Sub z3_Click(Index As Integer)

com

t1 = 3

End Sub

Private Sub z4_Click(Index As Integer)

com

t1 = 4

End Sub

Private Sub z5_Click(Index As Integer)

tmp = Mid(l1.Caption, Len(l1.Caption), 1)

If tmp = "." Then

t = 0

End If

If Len(l1.Caption) = 1 Then

l1.Caption = "0"

Else

l1.Caption = Left(l1.Caption, Len(l1.Caption) - 1)

End If

End Sub

Private Sub z6_Click(Index As Integer)

l1.Caption = "0"

Form_Load

End Sub

Private Sub z7_Click(Index As Integer)

If (l1.Caption "0") Then

l1.Caption = "-" + l1.Caption

End If

End Sub

Private Sub z8_Click(Index As Integer)

com

l1.Caption = Str(y)

End Sub

扩展资料

语言缺点

Visual Basic 语言具有不支持继承、无原生支持多线程、异常处理不完善等三项明显缺点,使其有所局限性(此些缺点皆已在 vb 点虐 获得改进)。

不支持继承

VB 5.0 和 VB 6.0 都是基于对象的编程语言,但是不包含继承特性。VB 中提供了特殊的类的功能,但是还是不能满足程序员的需求。

无原生支持多线程

Visual Basic 对于多线程无原生支持,只能通过Windows API的调用实现,且极其的不稳定。因为在API创建的线程中,并没有自动初始化运行时库,导致部分的函数无法使用。一般的,在VB6等早期的VB开发环境下,使用API创建线程的目的是完成容易使程序假死的大量数据或者逻辑的计算。

异常处理不完善

Visual Basic 中内置异常处理,即使未写异常处理代码,一旦用户出错也会弹出一个明确写出出错原因对话框,接着程序终止。

Visual Basic 中可以使用 Err.Raise抛出异常。对系统及用户抛出的异常的处理常用两种模式:一是使用 On Error Resume Next 处理错误;另一种是使用 On Error Goto 将运行引入错误处理代码。但相对 C++ 等语言而言,这样的异常处理破坏了代码的结构。

参考资料:百度百科-VB

如何用vb点虐 编写一个简单的计算器程序啊?多谢啊

你自己颤灶加窗体和空茄乎扮顷信件吧

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点虐 实现计算器的简单介绍
文章URL:http://cdkjz.cn/article/ddpihcg.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220