CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Code Debug

  1. #1
    Join Date
    Feb 2009
    Posts
    192

    Code Debug

    The following code give me an error where it is highlighted red can anyone please tell me why..

    I would like to undo the changes if No is clicked.

    Dim Cancel As Boolean
    If TxtOracleNo.Text <> TextBox6.Text Then
    If MsgBox("Do you wish to update oracle number?", vbYesNo) = vbYes Then
    Else
    Cancel = True
    Me.Undo()
    MsgBox("The change has been discarded", vbOKOnly)
    End If
    End If


    Thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Code Debug

    I have never heard of any method called Undo. If you want to Undo changes that have been done, you will actually have to write the code for that. In your case it seems you want to reset the fields on the form, so you should write the code to clear the fields instead of using Me.undo().

    Also I have observed that whenever you post code, you do not use CODE tags, which makes it difficult for people to go through your posts because the actual text of the post and the code are all mixed up. Please go through this link to see how you can use CODE tags. http://www.codeguru.com/forum/misc.php?do=bbcode#code

    Apart from that, when you are using VB.NET, you should try to use proper VB.NET objects and methods. To show a message box, you should MessageBox class, rather than MsgBox.

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

Featured