Results 1 to 3 of 3

Thread: code problem...

  1. #1

    Thread Starter
    Lively Member chxxangie's Avatar
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    79

    code problem...

    Code:
    Private Sub CheckStartList()
    Dim a As Integer
    
    If Option1(2).Value Then
        start_tag = Val(Text1(8))
        For a = 0 To List1(aa).ListCount - 1
            If List1(aa).List(a) > Val(start_tag) Then
                getStart = a
                Exit Sub
            Else
                getStart = -1
            End If
        Next
    End If
    
    If Option2(0).Value Then
        start_tag = Val(Text1(8))
        For a = 0 To List1(aa).ListCount - 1
            If List1(aa).List(a) < Val(start_tag) Then
                getStart = a
                Exit Sub
            Else
                getStart = -1
            End If
        Next
    End If
    End Sub
    
    
    Private Sub CheckStopList()
    Dim a, b As Integer
    
        If Option1(3).Value Then
            stop_tag = Val(Text1(9))
            For a = 0 To List1(aa).ListCount - 1
                If List1(aa).List(a) > Val(stop_tag) Then
                    If a > 0 Then getStop = a - 1
                    If a = 0 Then getStop = 0
                    If getStop >= getStart Then Exit Sub
                Else
                getStop = List1(aa).ListCount - 1
                End If
            Next
        End If
        
        If Option2(1).Value Then
            stop_tag = Val(Text1(9))
            For a = 0 To List1(aa).ListCount - 1
                If List1(aa).List(a) < Val(stop_tag) Then
                    If a > 0 Then getStop = a - 1
                    If a = 0 Then getStop = 0
                    If getStop >= getStart Then Exit Sub
                Else
                getStop = List1(aa).ListCount - 1
                End If
            Next
        End If    
    End Sub 
    
    Private Sub SaveLogFile_TXT()
            If chk_startLogging.Value = 1 Then
                If Option4(1).Value Then
                    num = 1
                    If cmb_channel.Text = "Channel 1" Then aa = 0
                    If cmb_channel.Text = "Channel 2" Then aa = 1
                    If cmb_channel.Text = "Channel 3" Then aa = 2
                    If cmb_channel.Text = "Channel 4" Then aa = 3
                    If cmb_channel.Text = "Channel 5" Then aa = 4
                    If cmb_channel.Text = "Channel 6" Then aa = 5
                    If cmb_channel.Text = "Channel 7" Then aa = 6
                    If cmb_channel.Text = "Channel 8" Then aa = 7
        
                    CheckStartList                
                    CheckStopList
                        
                    If List1(aa).List(0) <> "" Then
                        If getStart = -1 Then
                            Close #3
                            Exit Sub
                        End If
                        For c = getStart To getStop
                            Print #3, Format(num, "00000");
                            For b = 0 To 7
                                Print #3, Right$(Space(8) & List1(b).List©, 8);
                            Next b
                            Print #3,
                            num = num + 1
                        Next
                    End If
                    Close #3
                Exit Sub
                End If
            End If
    End Sub


    when running the code,there is no error...but sometimes the result is not correctly.....
    i think the problem is inside the "CheckStartList" or "CheckStopList".....

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: code problem...

    Some of your declarations are not included......
    but anyway you said "sometimes" that is quite odd.

  3. #3

    Thread Starter
    Lively Member chxxangie's Avatar
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    79

    Re: code problem...

    i had declared all of the variable as PUBLIC.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width