.net中用DropDownList选择日期(vb代码)
看了别人写的C#的 自己转了一下 然后后重新改了改 写成了这个
另外还有一个我写的验证日期是否合法的代码 在后面 都是vb的 c#只会看不会写
'判断闰年=======================
Private Function CheckLeap(ByVal year As Integer) As Boolean
If (year Mod 4 = 0) AndAlso (year Mod 100 <> 0) OrElse (year Mod 400 = 0) Then
Return True
Else
Return False
End If
End Function
'判断闰年结束=======================
'绑定每月的天数=====================
Private Sub BindDays(ByVal year As Integer, ByVal month As Integer)
Dim i As Integer
Dim AlDay As New ArrayList()
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
For i = 1 To 31
AlDay.Add(i)
Next
'Exit Select
Case 2
If CheckLeap(year) Then
For i = 1 To 29
AlDay.Add(i)
Next
Else
For i = 1 To 28
AlDay.Add(i)
Next
End If
'Exit Select
Case 4, 6, 9, 11
For i = 1 To 30
AlDay.Add(i)
Next
'Exit Select
End Select
DropDownList_day.DataSource = AlDay
DropDownList_day.DataBind()
End Sub
'绑定每月的天数结束=====================
'页面上拖三个DropDownList DropDownList_year DropDownList_month DropDownList_day 都要autopostback
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim AlYear As New ArrayList()
Dim i As Integer
For i = 1940 To 1992
AlYear.Add(i)
Next
Dim AlMonth As New ArrayList
For i = 1 To 12
AlMonth.Add(i)
Next
If Not Me.IsPostBack Th
相关文档:
虽然在VB里实现XP风格很简单,但是要使用XP风格同时又让按钮显示图片,则实现起来要麻烦一些,为此,我写了一个控件来实现前述功能,同时让读者可以从中了解XP主题界面的绘制过程。
使用办法很简单,在VB里新建一个工程,然后添加一个控件模块,粘贴以下代码,再将控件放置到窗口即 ......
http://www.webuc.net/ddf3/archive/2005/08/25/6142.aspx
不用FSO的复制文件夹得方法?
用API函数 SHFileOperation
以下是使用SHFileOperation删除复制移动文件的例子,可以复制文件夹
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pfrom As String
pTo As String
fFlags As ......
http://zhidao.baidu.com/question/33440250.html
在模块中输入以下代码
Public Declare Function sndPlaySound Lib "winmm" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
' flag uitzetten
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1 ......
'读数据到二进制字段
Public Sub ReadfromBLOB(filed As ADODB.Field, Filen As String)
Dim DataFile As Integer, Fl As Long, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, i As Integer
'传送块单位大小
Const ChunkSize As Integer = 16384
Dim MediaTemp As String
Dim lngOffset As Long
Di ......
从网上搜集到的VB代码,用EXE方式实现了远程注入,不过在反病毒软件的保护下,有可能导致注入失败。转贴这个代码,仅供大家学习和参考。
一、窗口代码:
Option Explicit
Private Sub cmdLock_Click()
If LockKeyboard(True) Then
cmdLock.Enabled = False
cmdUnLock.Enabled = Tr ......