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.
Thank you

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

how would I write this line in VB6?

charArray = Text20.Text.ToCharArray()

I have asked to move this to vb.net, the second post of course is a different story...

Dim charArray As String

charArray = "My string here"

Text20.Text = charArray
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.