Link to home
Start Free TrialLog in
Avatar of rajiv11
rajiv11

asked on

Nop in visual basic

Is there any statement equivalent to Nop (no operation command) in visual basic?

thanks
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Just curious...what language is Nop from and why would you use it?

Idle_Mind
ASKER CERTIFIED SOLUTION
Avatar of mccainz2
mccainz2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mccainz2
mccainz2

its in REXX and SQL among others....
I guess there are two commands that kinda do "nothing".

The first is DoEvents.  It causes all messages in your applications queue to be processed.

Do While Not someBooleanVariable
     DoEvents
Loop

The second is the Sleep() API.  It causes your application to be completely suspended for the specified amount of time in milliseconds.  During this period your application does not respond to any messages at all;as if it had crashed and hung.

Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Public Sub Form_Load()
    Sleep(5000) ' Do absolutely nothing for 5 seconds...
End Sub

Is this what you are looking for?

Idle_Mind
Not sure what is the meaning of your NOP ?
does it means can not make changes on such field or command , if yes , just diable such field or command
does it means no permmission to use such thing , then just disable it .
does it means if click the command button to process something , then  mccainz2 will be use .
 
I think you are talking about the ASM instruction "NOP".
But I dont think there was a function in vb that only call a NOP instruction.
Nope

There is no need for it.

I used to use it on mainframes (Honeywell 200/2000) when memory and speed were a problem, and programming tricks were needed. Instead of setting a variable and testing it to see if an instruction should be done, I would disable the instruction by turning in into a NOP.

Overwriting your machine level code is not considered to be a Good Thing, and is made as difficult as possible by today's operating systems.
 
Don't understand your question

If True Then
::::::::::::::::::
End If

8->
There is no equivalent.
There is no statement equivelent, however you can write a function to act as NOP or NO-OP.

You can send any variable or no variable into the function, and it will always return true, but you don't need to return the use as anything.  It will tell you that the client is working or that that section of the program is connected.

Public Function NOOP(optional anydata as varient) as boolean
  NOOP = true
End if

BTW:

        NOOP (NOOP)

            This command does not affect any parameters or previously
            entered commands.  It specifies no action other than that
            the receiver send an OK reply.
Instead of ...

if true then
 'Do Nothing
end if

Why dont you use

if false then
 'Do something
end if