A
Andy Chan
First of all, thanks to Crirus and Fergus for helping me with a related
posted a few days ago.
Ok, I can add images to my form (for whatever reason I cannot added more
than 1 image within the same procedure; rather I had to call the same
"addimage" procedure over and over again to get it working).
For anyone that's curious the code I used is the following:
----------------------------------------------------------------------------
-----------------
Sub dealcards(ByVal value As String, ByVal locX As Integer, ByVal locY As
Integer)
Dim myCard As New PictureBox()
Me.Controls.Add(myCard)
With myCard
myCard = New System.Windows.Forms.PictureBox()
.Visible = True
.Name = CStr(intCardsDealt)
intCardsDealt += 1
.Size = New System.Drawing.Size(70, 90)
.TabStop = False
.Location = New System.Drawing.Point(locX, locY)
.Image = Image.FromFile("c:\blackjack\" & value & ".jpg")
.BringToFront()
.Show()
End With
End Sub
----------------------------------------------------------------------------
----------------------------------------------------------------------
And if you're wondering, yes, I'm creating a blackjack game. (I'm trying to
improve my memory so that I can count cards. If anyone's interested in the
finished product, would be more than happy to share....so long as you don't
expect to win every time!!!)
Anyways, I've tried to surf around for my next problem: how to remove those
images I've added dynamically.
I tried:
Me.Controls.RemoveAt(mintCount) where mintCount is an integer count of the
control's index value.
I've even named the new picture box controls with the cstr(mintCount) value.
Thanks!
posted a few days ago.
Ok, I can add images to my form (for whatever reason I cannot added more
than 1 image within the same procedure; rather I had to call the same
"addimage" procedure over and over again to get it working).
For anyone that's curious the code I used is the following:
----------------------------------------------------------------------------
-----------------
Sub dealcards(ByVal value As String, ByVal locX As Integer, ByVal locY As
Integer)
Dim myCard As New PictureBox()
Me.Controls.Add(myCard)
With myCard
myCard = New System.Windows.Forms.PictureBox()
.Visible = True
.Name = CStr(intCardsDealt)
intCardsDealt += 1
.Size = New System.Drawing.Size(70, 90)
.TabStop = False
.Location = New System.Drawing.Point(locX, locY)
.Image = Image.FromFile("c:\blackjack\" & value & ".jpg")
.BringToFront()
.Show()
End With
End Sub
----------------------------------------------------------------------------
----------------------------------------------------------------------
And if you're wondering, yes, I'm creating a blackjack game. (I'm trying to
improve my memory so that I can count cards. If anyone's interested in the
finished product, would be more than happy to share....so long as you don't
expect to win every time!!!)
Anyways, I've tried to surf around for my next problem: how to remove those
images I've added dynamically.
I tried:
Me.Controls.RemoveAt(mintCount) where mintCount is an integer count of the
control's index value.
I've even named the new picture box controls with the cstr(mintCount) value.
Thanks!