Generate random string in text field

前端 未结 3 563
悲哀的现实
悲哀的现实 2021-01-18 10:45

We have that old software (made by one of the first employees many years ago) in company that uses Microsoft Access to run. Boss asked me to add a random string generation i

3条回答
  •  北海茫月
    2021-01-18 11:43

    Try this function:

    Public Function GetRandomString(ByVal iLength As Integer) As String
        Dim sResult As String = ""
        Dim rdm As New Random()
    
        For i As Integer = 1 To iLength
            sResult &= ChrW(rdm.Next(32, 126))
        Next
    
        Return sResult
    End Function
    

提交回复
热议问题