meteo
02-16-2004, 10:02 AM
Well, I thought everything was going alright until I noticed my tickers/counters weren't updating correctly. Here's my code:
tcount = 8
Select Case Len(tcount)
Case "1"
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & tcount & ".bmp")
Case "2"
intDigit1 = Left$(tcount, 1)
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
Case "3"
intDigit2 = Left$(tcount, 1)
intDigit1 = Left$(tcount, 2)
intDigit1 = Right$(intDigit1, 1)
frmBis.imgT2.Picture = LoadPicture(App.Path & "\Images\" & intDigit2 & ".bmp")
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
End Select
Now, the "tcount = 8" is NOT part of the code. It will always start out as "0" and then the code will do "tcount = tcount + 1". I just have it in there so that I can test high numbers without having to step through the code in order to increase the count.
Anyway, no matter what value I make tcount, the "Len(tcount)" will always return a 2. All the variables included (tcount, intDigit, etc) are stored as integers. My "ticker/counter" will allow up to 9999, though more than 99% of the time, numbers will not go above 250.
Does anyone know why this is not working? I could probably just set a new variable to store the length of tcount before I enter the Select Case, right? It would be something like this:
tcount = 8665
NewVar = Len(tcount)
Select Case NewVar
Case "1"
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & tcount & ".bmp")
Case "2"
intDigit1 = Left$(tcount, 1)
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
Case "3"
intDigit2 = Left$(tcount, 1)
intDigit1 = Left$(tcount, 2)
intDigit1 = Right$(intDigit1, 1)
frmBis.imgT2.Picture = LoadPicture(App.Path & "\Images\" & intDigit2 & ".bmp")
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
End Select
Would this be better to do or does it really matter? If you need any more info, please let me know.
Thanks!
tcount = 8
Select Case Len(tcount)
Case "1"
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & tcount & ".bmp")
Case "2"
intDigit1 = Left$(tcount, 1)
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
Case "3"
intDigit2 = Left$(tcount, 1)
intDigit1 = Left$(tcount, 2)
intDigit1 = Right$(intDigit1, 1)
frmBis.imgT2.Picture = LoadPicture(App.Path & "\Images\" & intDigit2 & ".bmp")
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
End Select
Now, the "tcount = 8" is NOT part of the code. It will always start out as "0" and then the code will do "tcount = tcount + 1". I just have it in there so that I can test high numbers without having to step through the code in order to increase the count.
Anyway, no matter what value I make tcount, the "Len(tcount)" will always return a 2. All the variables included (tcount, intDigit, etc) are stored as integers. My "ticker/counter" will allow up to 9999, though more than 99% of the time, numbers will not go above 250.
Does anyone know why this is not working? I could probably just set a new variable to store the length of tcount before I enter the Select Case, right? It would be something like this:
tcount = 8665
NewVar = Len(tcount)
Select Case NewVar
Case "1"
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & tcount & ".bmp")
Case "2"
intDigit1 = Left$(tcount, 1)
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
Case "3"
intDigit2 = Left$(tcount, 1)
intDigit1 = Left$(tcount, 2)
intDigit1 = Right$(intDigit1, 1)
frmBis.imgT2.Picture = LoadPicture(App.Path & "\Images\" & intDigit2 & ".bmp")
frmBis.imgT3.Picture = LoadPicture(App.Path & "\Images\" & intDigit1 & ".bmp")
frmBis.imgT4.Picture = LoadPicture(App.Path & "\Images\" & Right$(tcount, 1) & ".bmp")
End Select
Would this be better to do or does it really matter? If you need any more info, please let me know.
Thanks!