By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

stop scanning and display msg box after scanning reach EOF

kirubagari
100+
P: 158
For i = 49 To mfilesize Step 6

rich1.SelStart = Len(rich1.Text)


rich1.SelText = "Before : " & HexByte2Char(arrByte(i)) & _
" " & HexByte2Char(arrByte(i + 1)) & " " _
& HexByte2Char(arrByte(i + 2)) & " " _
& HexByte2Char(arrByte(i + 3)) & " " _
& HexByte2Char(arrByte(i + 4)) & " " _
& HexByte2Char(arrByte(i + 5)) _
& vbNewLine

If arrByte(i) <> a Then
arrByte(i) = a
changeMade = True

End If
If arrByte(i + 1) <> b Then
arrByte(i + 1) = b
changeMade = True
End If
If changeMade Then
AnyChanged = True
rich1.SelText = "After : " & HexByte2Char(arrByte(i)) & _
" " & HexByte2Char(arrByte(i + 1)) & " " _
& HexByte2Char(arrByte(i + 2)) & " " _
& HexByte2Char(arrByte(i + 3)) & " " _
& HexByte2Char(arrByte(i + 4)) & " " _
& HexByte2Char(arrByte(i + 5)) _
& " <--- Corrected" _
& vbNewLine

End If

Next




i want to popup msg box that will be display a msg that saying the scanning reach the last byte. It mean the scanning is finished.


this is the coding.is it correct?


if i=mfilesize then

msg box "SCANNNG IS FINISHED"
end if


and another question how to stop scanning when we wish to stop when the scanning is going on.what is the code
Jul 19 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
I don't think there's any need to check the value of your loop counter. Just put the MsgBox after the end of the loop. That is, after the Next statement.

Ok, here's a brief description of the sort of technique I use to interrupt a long-running process. I don't think there is really any "right" or "wrong" way (unless it doesn't work, of course, in which case it is wrong). But here's my way.
  • Create a global (or form-level) variable called UserWantsOut.
    The name is up to you, of course - that's just what I use. To make it global, place it in a code module (not a form) and use...
    Public UserWantsOut As Boolean
  • Place a button on your form labelled "Stop" or "Abort" or similar.
  • At the start of your process, show and/or enable the button, and set UserWantsOut to False.
  • At the end of your process, hide and/or disable the button.
  • In the click event procedure for the button, just do this...
    Expand|Select|Wrap|Line Numbers
    1. UserWantsOut = True
  • In your potentially long-running procedure, each time around the loop (or every 100 times, or 1,000 times or whatever), execute something like this...
    Expand|Select|Wrap|Line Numbers
    1. DoEvents ' <-- This is important.
    2. If UserWantsOut Then
    3.   Exit For
    4. End If

And in this case, after the Next statement I would do something like...
Expand|Select|Wrap|Line Numbers
  1. If UserWantsOut Then
  2.   MsgBox "Aborted by user!"
  3. Else
  4.   MsgBox "Finished!"
  5. End If
Jul 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.