This is the code I have to validate control number that we use to keep track of our inventory. However, I dont know much about Access so I have written and tested this function in VB.Net on Visual Studio. Now, I need to convert my code so it work in Access. Can someone please help me.
Public Class Form1 Dim charArray() As Char Private Sub btnCheck_Click(ByVal sender As System.Object, ByVal e A System.EventArgs) Handles btnCheck.Click Dim ValidChar As Boolean ValidChar = True If txtCheck.Text = Nothing Then MsgBox("Cannot have Null Control Number") Else charArray = txtCheck.Text.ToCharArray() If txtCheck.TextLength <> 10 Then ValidChar = False Else If charArray(0) < "A" Or charArray(0) > "Z" Then ValidChar = False Else For charCount As Integer = 1 To 9 If charArray(charCount) > "9" Or charArray < "0" Then ValidChar = False Exit For End If Next End If End If End If If ValidChar = False Then MsgBox("Invalid control number") End Sub End Class
Edited by Nick Evan: Added [CODE] - tags