vb程序设计实例100

vb程序设计实例100,第1张

试题一1

Private Sub Form_Click()

Print fs_sum(100)

End Sub

Function fs_sum(ByVal n As Integer) As Single

Dim s!, nc! '和与倒数

s=0

For i = 1 To n

nc = 1 / i

s = s + nc

Next i

fs_sum = s

End Function

试题一2

Private Sub Form_Click()

For i = 1 To 4

Print Space(4 - i);

For j = 1 To i

Print " ";

Next j

Print

Next i

End Sub

待续,未完

做下好人把,完整代码:

界面文件Form1Designervb :

<GlobalMicrosoftVisualBasicCompilerServicesDesignerGenerated()> _

Partial Class Form1

Inherits SystemWindowsFormsForm

'Form 重写 Dispose,以清理组件列表。

<SystemDiagnosticsDebuggerNonUserCode()> _

Protected Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing AndAlso components IsNot Nothing Then

componentsDispose()

End If

MyBaseDispose(disposing)

End Sub

'Windows 窗体设计器所必需的

Private components As SystemComponentModelIContainer

'注意: 以下过程是 Windows 窗体设计器所必需的

'可以使用 Windows 窗体设计器修改它。

'不要使用代码编辑器修改它。

<SystemDiagnosticsDebuggerStepThrough()> _

Private Sub InitializeComponent()

MeCommand1 = New SystemWindowsFormsButton

MeCommand2 = New SystemWindowsFormsButton

MeLabel1 = New SystemWindowsFormsLabel

MeSuspendLayout()

'

'Command1

'

MeCommand1Location = New SystemDrawingPoint(57, 173)

MeCommand1Name = "Command1"

MeCommand1Size = New SystemDrawingSize(75, 23)

MeCommand1TabIndex = 0

MeCommand1Text = "显示"

MeCommand1UseVisualStyleBackColor = True

'

'Command2

'

MeCommand2Enabled = False

MeCommand2Location = New SystemDrawingPoint(161, 173)

MeCommand2Name = "Command2"

MeCommand2Size = New SystemDrawingSize(75, 23)

MeCommand2TabIndex = 1

MeCommand2Text = "退出"

MeCommand2UseVisualStyleBackColor = True

'

'Label1

'

MeLabel1BorderStyle = SystemWindowsFormsBorderStyleFixedSingle

MeLabel1Location = New SystemDrawingPoint(43, 31)

MeLabel1Name = "Label1"

MeLabel1Size = New SystemDrawingSize(206, 104)

MeLabel1TabIndex = 3

MeLabel1Text = "Label1"

'

'Form1

'

MeAutoScaleDimensions = New SystemDrawingSizeF(60!, 120!)

MeAutoScaleMode = SystemWindowsFormsAutoScaleModeFont

MeClientSize = New SystemDrawingSize(292, 270)

MeControlsAdd(MeLabel1)

MeControlsAdd(MeCommand2)

MeControlsAdd(MeCommand1)

MeName = "Form1"

MeText = "Form1"

MeResumeLayout(False)

End Sub

Friend WithEvents Command1 As SystemWindowsFormsButton

Friend WithEvents Command2 As SystemWindowsFormsButton

Friend WithEvents Label1 As SystemWindowsFormsLabel

End Class

代码文件 Form1vb :

Public Class Form1

Dim clickCount As Int32

Private Sub Command1_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Command1Click

If (clickCount Mod 2) = 0 Then

Label1Text = "这是我的第一个VB程序"

Command1Text = "继续"

Else

Label1Text = "请你赐教,谢谢!"

Command1Text = "显示"

End If

If (clickCount > 0) Then

Command2Enabled = True

End If

clickCount += 1

End Sub

Private Sub Command2_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Command2Click

End

End Sub

End Class

>

以上就是关于vb程序设计实例100全部的内容,包括:vb程序设计实例100、一个简单的Visual Basic程序的创建实例、求简单的vb入门编程实例教程等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9498470.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存