Click here to Skip to main content
15,902,634 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan10-Apr-09 10:58
ymilan10-Apr-09 10:58 
GeneralRe: Need Help with Shuffle of a deck Pin
riced10-Apr-09 11:08
riced10-Apr-09 11:08 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan11-Apr-09 6:13
ymilan11-Apr-09 6:13 
GeneralRe: Need Help with Shuffle of a deck Pin
riced12-Apr-09 3:50
riced12-Apr-09 3:50 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan12-Apr-09 5:58
ymilan12-Apr-09 5:58 
GeneralRe: Need Help with Shuffle of a deck Pin
riced12-Apr-09 6:29
riced12-Apr-09 6:29 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan12-Apr-09 6:38
ymilan12-Apr-09 6:38 
GeneralRe: Need Help with Shuffle of a deck Pin
riced12-Apr-09 7:12
riced12-Apr-09 7:12 
It looks like you have missed an index somewhere. The only way to find out is to go through them one by one.
The reason I asked was that I thought if the indexes go from 1 to 52 you could have an Image1(0) that can be made invisible (you could do this in the Form_Load event, and it wouldn't matter where it is on the screen). You could then use this in the shuffle instead of tmpCard when doing the swap. That way you know it is the correct type.
So you could have something like this for swapping:
If (card1 <> card2) Then
   Image1(0).Picture = Image1(card1).Picture
   Image1(card1).Picture = Image1(card2).Picture
   Image1(card2).Picture = Image1(0).Picture
End If

In your loop I'd avoid using the goto, you need something like:
For counter = 1 to 100 'Do 100 swaps to shuffle deck
   'do the shuffling here
Next counter

A disadvantage of setting the bitmaps in the designer is that it would be tedious to set the images to use a different set of cards (but that probably isn't a worry). Another one is you have to make sure you don't have gaps in the indexes and it looks like you have a gap (else the indexes would be 0 to 51).
Because of the way card1 and card2 are calculated they will be between 1 and 52 so your indexes for Image1() need to be in the same range. This avoids having to do -1 somewhere to get the correct range (in fact you could just drop the +1 when calculating card1 and card2 instead of using -1).

Regards
David R

GeneralRe: Need Help with Shuffle of a deck Pin
ymilan12-Apr-09 7:21
ymilan12-Apr-09 7:21 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan12-Apr-09 8:26
ymilan12-Apr-09 8:26 
GeneralRe: Need Help with Shuffle of a deck Pin
riced13-Apr-09 2:19
riced13-Apr-09 2:19 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan13-Apr-09 14:52
ymilan13-Apr-09 14:52 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan12-Apr-09 6:39
ymilan12-Apr-09 6:39 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan11-Apr-09 8:45
ymilan11-Apr-09 8:45 
AnswerRe: Need Help with Shuffle of a deck Pin
riced10-Apr-09 3:59
riced10-Apr-09 3:59 
GeneralRe: Need Help with Shuffle of a deck Pin
ymilan10-Apr-09 4:54
ymilan10-Apr-09 4:54 
QuestionVisual Studio, VB.Net ODBC Read from Progress Database Pin
RDCK9-Apr-09 8:51
RDCK9-Apr-09 8:51 
AnswerRe: Visual Studio, VB.Net ODBC Read from Progress Database Pin
Johan Hakkesteegt9-Apr-09 9:35
Johan Hakkesteegt9-Apr-09 9:35 
GeneralRe: Visual Studio, VB.Net ODBC Read from Progress Database Pin
RDCK14-Apr-09 12:40
RDCK14-Apr-09 12:40 
QuestionRounding problem w/ var of type single Pin
Jon_Boy9-Apr-09 7:09
Jon_Boy9-Apr-09 7:09 
AnswerRe: Rounding problem w/ var of type single Pin
Jon_Boy9-Apr-09 7:22
Jon_Boy9-Apr-09 7:22 
AnswerRe: Rounding problem w/ var of type single Pin
Dave Kreskowiak9-Apr-09 7:46
mveDave Kreskowiak9-Apr-09 7:46 
GeneralRe: Rounding problem w/ var of type single Pin
Jon_Boy9-Apr-09 7:59
Jon_Boy9-Apr-09 7:59 
GeneralRe: Rounding problem w/ var of type single Pin
Dalek Dave9-Apr-09 9:01
professionalDalek Dave9-Apr-09 9:01 
QuestionHow can I add a column using VB? Pin
enipla9-Apr-09 5:28
enipla9-Apr-09 5:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.