Is there a way to upgrade ListBoxto an UserFormoutside Userform_Initializesub?
Why? I create a blackjack game and use lists to tell the user which cards they have / the dealer has. I was hoping to use simple sub ( ShowCards) to add items to the list, but I ran into problems:

The Play button calls up the PlayBlackjack element , which is located in the normal module
Option Explicit
Dim cards As New Collection
Sub ShowGame()
UFDisplay.Show
End Sub
Sub PlayBlackjack()
'fill the cards collection with 5 shuffled decks
PrepareCards
Dim i As Integer
Dim userHand As New Collection
Dim dealerHand As New Collection
'deal cards (removing the dealt cards from the cards collection)
For i = 1 To 2
DealCard cards, userHand
DealCard cards, dealerHand
Next i
ShowCards userHand, UFDisplay.UserHandList <-- ERROR HERE (Type mismatch)
'more code to follow
End Sub
Private Sub ShowCards(hand As Collection, list As ListBox)
Dim i As Integer
For i = 1 To hand.Count
list.AddItem hand(i).CardName
Next i
End Sub
Let me know if you think you need more code. handis a collection of map classes where it .CardNamereturns something like3 of Hearts
, , , , , - . Userform.Repaint .
, , userHand dealerHand , Useform_Initialize, ? , , , .
. , -, ( )
# 1
ShowGame , PlayBlackjack Userform ( )