Solved

Nop in visual basic

Posted on 2003-12-04
12
3,770 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 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…
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…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

624 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