重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
在自定义工具箱中选择dirlistbox,drivelistbox,filelistbox,添加这3个控件,然后在窗体上添加这些控件和一个picturebox控件,代码如下:
按需求定制制作可以根据自己的需求进行定制,做网站、网站建设构思过程中功能建设理应排到主要部位公司做网站、网站建设的运用实际效果公司网站制作网站建立与制做的实际意义
Public Class Form1
Private Sub DirListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DirListBox1.SelectedIndexChanged
FileListBox1.Path = DirListBox1.Path
End Sub
Private Sub DriveListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DriveListBox1.SelectedIndexChanged
DirListBox1.Path = DriveListBox1.Drive
End Sub
Private Sub FileListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileListBox1.SelectedIndexChanged
PictureBox1.Image = Image.FromFile(FileListBox1.Path + "\" + FileListBox1.SelectedItem.ToString())
End Sub
End Class
你可以自己在修改下,这只是个模型,呵呵!
'添加一个label标签名字label1 用来显示时间
'再添加一个timer控件 名字timer1 interval属性=1000 用来计时
'窗体添加代码
Dim t As Date '用来记录时间
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Timer1.Tick
t = t.AddSeconds(1)
Label1.Text = "登录时间:" t.TimeOfDay.ToString
End Sub
1,窗体上使用容器控件比如:Panel,在容器控件里添加文本框,用来显示滚动的号码。
2,添加一个Timer控件,用来不断改变上述文本框的Top属性,实现不断向上滚动的动态效果。
3,使用系统的随机函数,生成所想要的适当位数的随机数,单击按钮,停止滚动,显示随机数。
4,用数组保存产生的随机数,再次停止,与已经产生的保存在数组里的随机进行比较,如果重复,就重新生成随机数,直到不重复。
注意:参数为动态数组;
Private Function MyF(ByRef d() As Integer)
ReDim d(4, 13) As Integer
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim MyNum(4) As Integer
For i = 1 To 4
MyNum(i) = 0
Next i
Randomize
For i = 1 To 4
For j = 1 To 13
n = Int(Rnd * 4 + 1)
Do While MyNum(n) = 13
n = Int(Rnd * 4 + 1)
Loop
d(i, j) = n
MyNum(n) = MyNum(n) + 1
Next j
Next i
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oleDbConnection1 As OleDb.OleDbConnection
Dim oledbDataAdapter As OleDb.OleDbDataAdapter
Dim oledbData As DataSet = New DataSet
Dim strConnect As String = "Provider= OraOLEDB.Oracle;Data Source=888;User ID=888;Password=888;"
oleDbConnection1 = New System.Data.OleDb.OleDbConnection(strConnect)
Dim strSql As String
strSql = "select *" " from xx"
Dim oledbCommand As OleDb.OleDbCommand
oledbCommand.CommandText = strSql
oledbCommand.CommandType = CommandType.Text
oledbCommand.Connection = oleDbConnection1
oledbDataAdapter.SelectCommand = oledbCommand
oleDbConnection1.Open()
oledbDataAdapter.Fill(oledbData, "gy_bingrenxx")
oleDbConnection1.Close()
'在窗体上添加一个DataGridView控件,在这个位置加一句代码
DataGridView1.DataSource = oledbDataAdapter.Tables("gy_bingrenxx")
End Sub
可以实现
搞个button,点击的时候连接数据库,写入数据
再搞个button,点击的时候,连接数据库,查询数据,显示在datagridview里面(将查询到的数据存在datatable中,再把datatable赋给datagridview的datasource就可以了)