jeudi 22 août 2019

Cant take string values from array

Dim animals() As String = {"Dog", "Cat", "Goat", "Cow"} Dim randomAnimal As Single = Int((UBound(Animals)+1)*Rnd())

Above code gives me a index value of an array instead of string

Tried the below one but it doesnt work

Dim intIndex As Integer= Int(randomAnimal)

Dim animals() As String = {"Dog", "Cat", "Goat", "Cow"}
 Dim randomAnimal As Single = Int((UBound(Animals)+1)*Rnd())  

Expected Result: Need to get any animal names in randomanimal from an array




Aucun commentaire:

Enregistrer un commentaire