vb.net控件说明,vb控件大全使用详解书
vb.net 控件属性设置
如控件自身无法设置滚动条,那就在父容器控件中(如FORM)使用滚动条解决问题。另外,也可将日期控件放在弹出窗口中,
成都创新互联公司长期为上1000+客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为惠济企业提供专业的网站设计、网站制作,惠济网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。
vb.net中,控件的tag属性是什么意思?
从tag这个名字就可以看出,这是一个标签属性,或者说是附注、标注、说明,一般情况下是没什么作用的,但是可以用它来保存一些临时性的数据,这样可以不用另外定义临时变量。你说的例子就是这样,是把obj这个对象的大小和位置临时保存在tag属性里,在后面的语句里就可以随时调用了。
VB.NET中使用AspNetPager控件的详细用法
AspNetPager简单使用方法 AspNetPager作为分页工具,常常用于绑定数据控件,如DataGrid , Repeater等
在这里,简单讲解下 绑定 Repeater 控件的方法,其余控件绑定方法类似:
'全局变量 i 用于 读取 数据集记录的条数(注意:读取一次就够了)
Dim i As New Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If i = 0 Then
con = New SqlConnection(ConfigurationManager.ConnectionStrings("NEWS_ConnectionString").ConnectionString)
con.Open()
cmd = New SqlCommand()
cmd.Connection = con
cmd.CommandText = "select count(*) from XWNRB "
'AspNetPager控件 可见
Me.AspNetPager1.Visible = True
'AspNetPager控件 每页显示大小为10条记录
Me.AspNetPager1.PageSize = 10
'AspNetPager控件 记录总的记录条数
Me.AspNetPager1.RecordCount = Convert.ToInt32(cmd.ExecuteScalar())
'AspNetPager控件 数据绑定
Me.SHOW_DATA_LIST()
i = i + 1
con.Close()
End If
End Sub
Protected Sub SHOW_DATA_LIST()
con = New SqlConnection(ConfigurationManager.ConnectionStrings("NEWS_ConnectionString").ConnectionString)
sql_Text = "select * from XWNRB where "
da = New SqlDataAdapter(sql_Text, con)
Dim ds As New Data.DataSet
'第一个参数为存储入的数据集为ds
'第二个参数为存储的起始记录序号
'第三个参数为存储的记录每页条数
'第四个参数为存储入的数据集ds中的具体某个表
da.Fill(ds, Me.AspNetPager1.PageSize * (Me.AspNetPager1.CurrentPageIndex - 1), Me.AspNetPager1.PageSize, "NEWS_LIST")
'真正绑定
Me.Repeater2.DataSource = ds.Tables("NEWS_LIST").DefaultView
Me.Repeater2.DataBind()
End Sub
'即每次点击新的页面,或者点击 Pre,Next,Last.....时候都会触发这个事件
Protected Sub AspNetPager1_PageChanged(ByVal src As Object, ByVal e As Wuqi.Webdiyer.PageChangedEventArgs) Handles AspNetPager1.PageChanged
'更新当前所在的页数序列
Me.AspNetPager1.CurrentPageIndex = e.NewPageIndex
'更新完后绑定
Me.SHOW_DATA_LIST()
End Sub
VB.net 如何编写用户控件?
Public Class UserControl1
#Region "变量"
Dim Down_Color As Color = Color.Blue
Dim UP_Color As Color = Color.Gray
Dim Mode As Short = 0
Dim flag As Boolean
Dim offset_X As Integer
Dim offset_Y As Integer
Dim Mouse_P As Point
#End Region
#Region "属性"
'按下颜色
Public Property _DownColor As Color
Get
Return Down_Color
End Get
Set(ByVal value As Color)
Down_Color = value
End Set
End Property
'弹起颜色
Public Property _UpColor As Color
Get
Return UP_Color
End Get
Set(ByVal value As Color)
UP_Color = value
End Set
End Property
'滑动模式 0-横 1-竖
Public Property _Mode As Short
Get
Return Mode
End Get
Set(ByVal value As Short)
Mode = value
End Set
End Property
#End Region
Private Sub UserControl1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.BackColor = UP_Color
End Sub
'鼠标按下
Private Sub UserControl1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
Me.BackColor = Down_Color
Mouse_P = e.Location
flag = True
End Sub
'鼠标移动
Private Sub UserControl1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If flag = False Then Exit Sub
Select Case Mode
Case 0 '横向·
offset_X = e.X - Mouse_P.X
If Me.Location.X + offset_X + Me.Width = Me.ParentForm.Width Or Me.Location.X + offset_X = 0 Then
flag = False
Else
Me.Location = New Point(Me.Location.X + offset_X, Me.Location.Y)
End If
Case 1 '竖向·
offset_Y = e.Y - Mouse_P.Y
If Me.Location.Y + offset_Y + Me.Height + 30 = Me.ParentForm.Height Or Me.Location.Y + offset_Y = 0 Then
flag = False
Else
Me.Location = New Point(Me.Location.X, Me.Location.Y + offset_Y)
End If
End Select
End Sub
'鼠标弹起
Private Sub UserControl1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
Me.BackColor = UP_Color
flag = False
End Sub
End Class
vb.net 文件夹操作
vb.net使用控件FolderBrowserDialog1,在程序中:
'设置对话框中在树视图控件上显示的说明文本
Me.FolderBrowserDialog1.Description
=
"请选择输出报表所在路径:"
'设置从其开始浏览的根文件夹
Me.FolderBrowserDialog1.SelectedPath
=
"c:\"
If
Me.FolderBrowserDialog1.ShowDialog()
=
DialogResult.OK
Then
'取得全路径(包含文件名)
reportPath1
=
System.IO.Path.GetFullPath(Me.FolderBrowserDialog1.SelectedPath)
'设定text显示文件名
txtReport1.Text
=
reportPath1
setReportList()
End
If
在setReportList()中针对你所需要的文件进行操作等
如何声明控件属性 vb.net
Public Class ControlValue
Inherits Control
''' summary
''' 获取或设置控件的值。
''' /summary
System.ComponentModel.Browsable(True)
System.ComponentModel.Category("布局")
System.ComponentModel.Description("获取或设置控件的值。")
Public Property Value As String
End Class
名称栏目:vb.net控件说明,vb控件大全使用详解书
分享URL:http://ybzwz.com/article/hcsjig.html