Results 1 to 4 of 4

Thread: VB equal to the Javascript "return false"

  1. #1

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70

    Question VB equal to the Javascript "return false"

    How could I make VB do "return false" as in javascript
    something like this
    <body onContextmenu="return false">

    but in vb

  2. #2

    Thread Starter
    Lively Member Blaster's Avatar
    Join Date
    Jun 2001
    Posts
    70
    also how could I do this to Command1?

    <input type="button" value="Command1" onFocus="if(this.blur)this.blur()">
    how could I do something like that?

  3. #3
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    VB works kinda differently....

    Code:
    Private Sub Command1_LostFocus()
        If Not doSomething Then
        'is the same as :
        'If (doSomething = False) Then
            MsgBox "doSomething returned false"
        End If
    End Sub
    
    Private Function doSomething() As Boolean
        'to return a value, you set the function/sub's name to the value
        'same as return false
        doSomething = False
    End Function
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    1) The equivalent is a boolean value (take a look at this in the MSDN help file).
    Basically, if you want to return false when a button's clicked, you could use something like the attachment.

    2) You draw a button onto the form, then set the name and caption properties of this in the properties window in VB.
    To get code to execute when the button's clicked, just double click on the button & you'll be taken to the code window.

    Whatever you type between the "Private Sub Command1_Click()" and "End Sub"

    will be run when the buttons clicked !

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width