Solved

Nop in visual basic

Posted on 2003-12-04
12
3,679 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +5
12 Comments
 
LVL 86

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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 86

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
 
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 86

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

752 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