1、1、了解VB.NET系统对计算机软、硬件的要求。2、掌握启动与退出VB.NET的方法。3、掌握建立、编辑和运行一个简单的VB.NET应用程序的全过程。4、掌握常用控件文本框、标签、命令按钮、图片框的使用。二实验环境VB.NET和相关硬件三、实验内容与步骤1、 创建一个“windows应用程序”类型的应用程序,要求在屏幕上显示“欢迎学习VB.NET”,在文本框中输入你的姓名,在标签中显示输入的姓名。2、 编一个程序,在文本框中统计该窗口上鼠标单击的次数。3、 对窗体三个事件过程(Load、Click、DoubleClick)编程,三个事件中装入不同的图片。按钮、字号、内容和格式的复制练习。四、实
2、验过程与分析一、Public Class 一_1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox2.Text = TextBox1.Text If TextBox1.Text = Then MsgBox(请输入姓名, 0) TextBox1.Focus() End If End Sub Private Sub 一_1_Load(ByVal sender As System.Object, ByVal e As S
3、ystem.EventArgs) Handles MyBase.LoadEnd Class二、Public Class 一_3 Sub 一_3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click TextBox1.Text = Val(TextBox1.Text) + 1 End Class三、Public Class 一_4 Private Sub 一_4_Load(ByVal sender As System.Object, ByVal e As System.Even
4、tArgs) Handles MyBase.Load Me.Text = 装入窗体 Me.BackgroundImage = Image.FromFile(一-4a.jpg) Me.BackgroundImageLayout = ImageLayout.Stretch Sub 一_4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click单击窗体一-4b.jpg Me.MaximizeBox = True Me.MinimizeBox = True Sub 一_4_double
5、click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.DoubleClick双击窗体 Me.MaximizeBox = False Me.MinimizeBox = False Me.BackgroundImage = Nothing Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D Me.Cursor = Cursors.Default四、Public Class 一_5 Private Sub Button2_Cli
6、ck(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Font = New Font(隶书, 25) Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click幼圆, 15)请输入文本 Else If (TextBox1.SelectedText = ) Then MsgBox(请选择要复制的文字 Else TextBox2.Text = TextBox1.SelectedText TextBox2.Font = TextBox1.Font End If五、实验总结通过本次的实验对VB.NET有了初步的了解,并经过几个简单的程序后使对其有了一定的应用。
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1