Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

VB6 Help with looping

Can anyone tell me what I'm doing wrong here.

Private Sub cmdVending_Click()

Dim IntTotal As Integer
Dim IntCnt As Integer
Dim StrPrice As String
Dim IntPos As Integer
Dim IntValue As Integer


If lstMenu.Selected(0) Then
For IntCnt = 1 To 6
If lstMenu.Selected(IntCnt) Then
IntPos = InStr(lstMenu.Selected(IntCnt), "$")
StrPrice=mid$(lstMenu.Selected(IntCnt),IntPos,Len (lstMenu.Selected(IntCnt)

IntValue = Val(StrPrice)
IntTotal = IntTotal + IntValue
Next IntCnt

Comments

  • paulj59paulj59 Member Posts: 420
    : Can anyone tell me what I'm doing wrong here.
    :
    : Private Sub cmdVending_Click()
    :
    : Dim IntTotal As Integer
    : Dim IntCnt As Integer
    : Dim StrPrice As String
    : Dim IntPos As Integer
    : Dim IntValue As Integer
    :
    :
    : If lstMenu.Selected(0) Then
    : For IntCnt = 1 To 6
    : If lstMenu.Selected(IntCnt) Then
    : IntPos = InStr(lstMenu.Selected(IntCnt), "$")
    : StrPrice=mid$(lstMenu.Selected(IntCnt),IntPos,Len (lstMenu.Selected(IntCnt)
    :
    : IntValue = Val(StrPrice)
    : IntTotal = IntTotal + IntValue
    : Next IntCnt
    :
    :
    IntValue = Val(StrPrice)
    val("$..")=0
    Try intValue=CCur(Strprice), or else int(mid$(StrPrice,2))
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ___ | http://forcoder.org | free video tutorials and ebooks about \ C, Go, Java, Scratch, Visual Basic, Ruby, C++, PHP, Delphi, R, Swift, Visual Basic .NET, MATLAB, Assembly, JavaScript, C#, Perl, Objective-C, PL/SQL, Python FoxPro, ML, Clojure, Lua, SAS, Logo, Erlang, Dart, Awk, ABAP, Apex, Scala, Ada, COBOL, Alice, Crystal, Julia, Lisp, Transact-SQL, Hack, D, Kotlin, F#, Prolog, Fortran, Bash, Scheme, Rust, VBScript, LabVIEW \ ___________

Sign In or Register to comment.