troubleshooting Question

vb.net - get random integer

Avatar of XK8ER
XK8ERFlag for United States of America asked on
Visual Basic.NET
8 Comments1 Solution545 ViewsLast Modified:
hello there,
I would like to get a random integer between two different numbers from textbox..
how can I do that?
Function GetAge(TextA As TextBox, TextB As TextBox)
    Dim lb1 As Long, ub2 As Long
    If IsNumeric(TextA.Text) And IsNumeric(TextB.Text) Then
        lb1 = CLng(TextA.Text)
        ub2 = CLng(TextB.Text)
        GetAge = Int((ub2 - lb1 + 1) * Rnd + lb1)
    End If
End Function
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros