vb点虐 作业 vbnet writeline

Windows程序设计(VB.NET)》在线作业二

1.C

成都创新互联公司-专业网站定制、快速模板网站建设、高性价比沐川网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式沐川网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖沐川地区。费用合理售后完善,10多年实体公司更值得信赖。

2.A

3.A

4.A

5.A

6.C

7.D

8.A

9.A

10.D

11.D

12.D

13.B

14.D

15.A

16.B

17.C

18.A

1.A

2.B

VB点虐 作业,用VB做一个简单的计算器.

我用VB做的你看能不能用

Public b

Public c

Public d

Public e

Public f

Private Sub Command14_Click()

d = ""

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Exit Sub

'c = Text1.Text

If b = "" Then Exit Sub

If e = "+" Then

d = f + b

Else

If e = "-" Then

d = f - b

Else

If e = "*" Then

d = f * b

Else

If e = "/" Then

If b = 0 Then

MsgBox "被除数不能为零!"

Exit Sub

End If

d = f / b

Else

MsgBox "错误操作!"

End If

End If

End If

End If

Text1.Text = d

b = ""

c = ""

e = ""

End Sub

Private Sub Command15_Click()

Text1.Text = ""

b = ""

c = ""

d = ""

e = ""

f = ""

End Sub

Private Sub Form_Load()

Text1.Text = ""

End Sub

Private Sub Command1_Click()

'判断开头有运算符就清零

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

'判断开头有0就禁止输入数字

If Text1.Text = "0" Then

Else

a = 1

'发现运算结果就清零

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text '得到当前操作数

End Sub

Private Sub Command2_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 2

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command3_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 3

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command4_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 4

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command5_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 5

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command6_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 6

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command7_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 7

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command8_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 8

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command9_Click()

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

If Text1.Text = "0" Then

Else

a = 9

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

End If

b = Text1.Text

End Sub

Private Sub Command10_Click()

If b = "" Then Exit Sub

a = "+"

e = "+"

f = b

Text1.Text = ""

Text1.Text = Text1.Text a

End Sub

Private Sub Command11_Click()

If b = "" Then Exit Sub

f = b

a = "-"

e = "-"

Text1.Text = ""

Text1.Text = Text1.Text a

End Sub

Private Sub Command12_Click()

If b = "" Then Exit Sub

a = "*"

e = "*"

f = b

Text1.Text = ""

Text1.Text = Text1.Text a

End Sub

Private Sub Command13_Click()

If b = "" Then Exit Sub

a = "/"

e = "/"

f = b '把操作数1提取出来

Text1.Text = ""

Text1.Text = Text1.Text a

End Sub

Private Sub Command16_Click()

'判断有运算符就清零

If Text1.Text = "+" Or Text1.Text = "-" Or Text1.Text = "*" Or Text1.Text = "/" Then Text1.Text = ""

'判断有零和空值就禁止输入0

'发现运算结果就清零

If d "" Then Text1.Text = "": d = ""

If Text1.Text = "0" Then

Else

a = 0

If d "" Then Text1.Text = "": d = ""

Text1.Text = Text1.Text a

b = Text1.Text

End If

End Sub

vb点虐 作业,打开某一文件夹,将内容倒排,保存到另一文件夹怎么做

'这是VB的要先引用Microsoft Scripting RunTime,下面的例子是找叫cmd.xxx的文件的

Private Sub Command1_Click()

Dim m_objFSO As New FileSystemObject

Dim objFolder As Scripting.Folder '文件夹对象

Dim objFile As Scripting.File '文件对象

Set objFolder = m_objFSO.GetFolder("c:/test")

For Each objFile In objFolder.Files

Dim filenames() As String

filenames = Split(objFile.Name, ".")

If filenames(0) = "cmd" Then

FileCopy objFile.Path, "c:/TestCMD/" "newName." filenames(1)

End If

Next objFile

End Sub

-----------------------------------这是VB点虐 的--------------------------

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

Dim i As Integer

Dim files() As String

files = System.IO.Directory.GetFiles("C:/test")

For i = 0 To files.Length - 1

Dim filenames() As String

filenames = files(i).Substring(files(i).LastIndexOf("\") + 1).Split(".")

If filenames(0) = "cmd" Then

FileCopy(files(i), "c:/TestCMD/" "newName." filenames(1))

End If

Next

End Sub

vb点虐 作业,画坐标轴及标尺,画y=sin(x)曲线

Private Sub mainfrm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

Dim pt(200) As PointF

Dim a As Integer

For a = 0 To 200

pt(a).X = 50 * a

pt(a).Y = 200 - 50 * Math.Sin(a - 1)

Next

Me.CreateGraphics.DrawLine(Pens.Blue, 0, 200, 800, 200)

Me.CreateGraphics.DrawLine(Pens.Blue, 50, 0, 50, 600)

Me.CreateGraphics.DrawCurve(Pens.Blue, pt)

End Sub


名称栏目:vb点虐 作业 vbnet writeline
文章地址:http://scyanting.com/article/ddjpphi.html