vb.net例程,vbnet例程

关于VB.NET进度条的实例

这是我自己写的一个进度条控件,如图:

在江州等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站设计、网站建设 网站设计制作定制开发,公司网站建设,企业网站建设,品牌网站制作,网络营销推广,成都外贸网站建设,江州网站建设费用合理。

边框粗细和边框颜色以及进度条颜色都可以调。

进度条大小你可以自己拉伸。

同时,进度条还提供了丰富的动画效果(如边框闪烁效果【可关闭】,进度条滑动效果等。)

将边框粗细调为0即可实现无边框(同时边框闪烁效果(见“Flash”属性)也将关闭!)

进度值(见“ProgressValue”属性)类型为Single(单精度浮点数)

将我提供的DLL文件拖到工具箱即可安装

只能用于Windows窗体应用程序!

目标平台:.Net Framework 3.5

属性说明:

1.BorderColor 用于调整边框颜色

2.BorderWidth 用于调整边框粗细

3.Flash 用于开启、关闭边框闪烁效果

4.ProgressValue 用于设置、查看进度值

5.ForeColor 用于设置进度条颜色

6.BackColor 用于设置控件背景色

附件如果丢失,请私信。

VB.net中类的实例化

1.不正确

Dim abc As myClass,定义一个可以引用myClass类型对象的变量abc。这个abc变量存在于栈上。

abc=New myClass。New myClass创建myClass实例对象,这个对象存在于托管堆上。然后(同时)让abc引用(指向)这个对象。

abc变量在栈上,而对象在托管堆上。

abc储存的是对象的地址,而不是对象本身。

看下面的代码

Dim a As myClass,b As myClass,c As myClass

a=New myClass

b=a

c=a

整个过程中只创建了一个myClass对象,位于托管堆上。

三个myClass类型的变量a、b、c位于栈上,都指向了这一个myClass对象

2.类的成员分 实例成员 和 静态成员

实例成员 必须在实例对象上调用

静态成员 可以直接调用,不需要实例对象。

求一个用VB.net操作access数据库的例程

Imports System

Imports System.Drawing

Imports System.ComponentModel

Imports System.Windows.Forms

Imports System.Data.OleDb

Imports System.Data

Public Class Form1

Inherits Form

Private components As System.ComponentModel.Container = Nothing

Private WithEvents lastrec As Button

Private WithEvents nextrec As Button

Private WithEvents previousrec As Button

Private WithEvents firstrec As Button

Private t_books As TextBox

Private t_nl As TextBox

Private t_xb As TextBox

Private t_xm As TextBox

Private t_id As TextBox

Private l_books As Label

Private l_nl As Label

Private l_xb As Label

Private l_xm As Label

Private l_id As Label

Private label1 As Label

Private myDataSet As DataSet

Private WithEvents button1 As Button

Private WithEvents button2 As Button

Private WithEvents button3 As Button

Private WithEvents button4 As Button

Private myBind As BindingManagerBase

Public Sub New ( )

MyBase.New ( )

GetConnected ( )

InitializeComponent ( )

End Sub

'清除在程序中使用过的资源

Protected Overloads Overrides Sub Dispose (ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose ( )

End If

End If

MyBase.Dispose ( disposing )

End Sub

Public Sub GetConnected ( )

'创建一个数据连接

Dim strCon As String = " Provider = Microsoft.Jet.OLEDB.4.0 ;

Data Source = db.mdb "

Dim myConn As OleDbConnection = New OleDbConnection ( )

myConn.ConnectionString = strCon

Dim strCom As String = " SELECT * FROM person "

'创建一个 DataSet

myDataSet = New DataSet ( )

myConn.Open ( )

'通过OleDbDataAdapter对象得到一个数据集

Dim myCommand As OleDbDataAdapter = New OleDbDataAdapter

( strCom , myConn )

'把Dataset绑定books数据表

myCommand.Fill ( myDataSet , "person" )

'关闭此数据连接

myConn.Close ( )

End Sub

'插入数据记录操作代码

Private Sub button2_Click (ByVal sender As Object , _

ByVal e As System.EventArgs) Handles button2.Click

'判断所有字段是否添完,添完则执行,反之弹出提示

If ( t_id.Text "" And t_xm.Text ""

And t_xb.Text "" And t_nl.Text ""

And t_books.Text "" ) Then

Dim myConn1 As String = " Provider = Microsoft.Jet.OLEDB.4.0 ;

Data Source = db.mdb"

Dim myConn As OleDbConnection = New OleDbConnection ( myConn1 )

myConn.Open ( )

Dim strInsert As String = " INSERT INTO person ( id , xm , xb , nl

, zip ) VALUES ( " _

t_id.Text + " , '" _

t_xm.Text + "' , '" _

t_xb.Text + "' , " _

t_nl.Text + " , " _

t_books.Text + ")"

Dim inst As OleDbCommand = New OleDbCommand ( strInsert , myConn )

inst.ExecuteNonQuery ( )

myConn.Close ( )

myDataSet.Tables ( "person" ).Rows ( myBind.Position ).BeginEdit ( )

myDataSet.Tables ( "person" ).Rows ( myBind.Position ).EndEdit ( )

myDataSet.Tables ( "person" ).AcceptChanges ( )

Else

MessageBox.Show ( "必须填满所有字段值!" , "错误!" )

End If

End Sub


分享文章:vb.net例程,vbnet例程
新闻来源:http://hbruida.cn/article/dscieci.html