Solved

Nop in visual basic

Posted on 2003-12-04
12
3,388 Views
Last Modified: 2013-11-25
Is there any statement equivalent to Nop (no operation command) in visual basic?

thanks
0
Comment
Question by:rajiv11
  • 3
  • 2
  • 2
  • +5
12 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9878383
Just curious...what language is Nop from and why would you use it?

Idle_Mind
0
 
LVL 5

Accepted Solution

by:
mccainz2 earned 50 total points
ID: 9878396
errr I hesitate to post it but

if true then
 'Do Nothing
end if
0
 
LVL 5

Expert Comment

by:mccainz2
ID: 9878398
its in REXX and SQL among others....
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9878713
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
0
 
LVL 1

Expert Comment

by:MsLim
ID: 9879090
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 .
 
0
 
LVL 1

Expert Comment

by:prefix
ID: 9879603
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.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9881099
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.
 
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9881983
Don't understand your question

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

8->
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9882332
There is no equivalent.
0
 

Expert Comment

by:enari
ID: 9882619
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
0
 

Expert Comment

by:enari
ID: 9882642

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.
0
 
LVL 3

Expert Comment

by:ashoooo
ID: 9882899
Instead of ...

if true then
 'Do Nothing
end if

Why dont you use

if false then
 'Do something
end if

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VBA saving file message display 5 56
Windows 10 start screen issues 9 52
Having a different time zone on your task bar 3 53
How does CurrentUser work? 10 31
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now