Home
first avaliable drive
- Details
- Written by Super User
- Category: Visual Studio
- Hits: 2427
Public Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (ByRef lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Integer) As Integer
Public Function firstavaliabledrive() As Char
Dim drives As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Dim existingdrives() As DriveInfo = DriveInfo.GetDrives()
For Each drv In existingdrives
drives = drives.Replace(drv.ToString.Replace(":\", ""), "")
Next
For i As Integer = drives.Length - 1 To 0 Step -1
If Not IO.Directory.Exists(drives(i) & ":\") Then
Return drives(i)
Exit For
End If
Next
End Function
mail validation
- Details
- Written by Super User
- Category: Visual Studio
- Hits: 2133
Private Sub txt_mail_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles txt_mail.Validating
If txt_mail.Text <> String.Empty Then
reg = New Regex("^[_a-z0-9-]+(.[a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$")
If Not reg.IsMatch(txt_mail.Text) Then
EP_Error.SetError(txt_mail, "not Mail!")
EP_Ok.SetError(txt_mail, "")
e.Cancel = True
Else
EP_Error.SetError(txt_mail, "")
EP_Ok.SetError(txt_mail, "OK")
End If
reg = Nothing
End If
End Sub