Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Which is better practice for creating an array

$
0
0
Hey, I was wondering which is better practice, both work fine..
Dim strWin As Object = {btnBoard1, btnBoard2, btnBoard3, btnBoard4, btnBoard5, btnBoard6, bt9nBoard7, btnBoard8, btnBoard9
}

if strWin(0).text = "x" 


or

Dim strWin = {btnBoard1.Text, btnBoard2.Text, btnBoard3.Text, btnBoard4.Text, btnBoard5.Text, btnBoard6.Text, btnBoard7.Text, btnBoard8.Text, btnBoard9.Text}

        If strWin(0) = "X"


Also, why/what are the benefits or using one way over another? Also, in the second code, It wouldn't let me do As String, should I just leave the datatype blank?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>