Solved

Nop in visual basic

Posted on 2003-12-04
12
3,451 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 102
VBS file using code from 2nd file (txt or vbs) 4 36
VBA Shell can't Find Word document 11 92
MsgBox 4 59
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

813 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

12 Experts available now in Live!

Get 1:1 Help Now