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
Solved

vb6 code conversion to vb 2008

Posted on 2008-10-22
3
427 Views
Last Modified: 2010-04-21
I am new to visual basic and I was assigned the task of converting some old VB6 code to VB2008.
I have almost everything in the application converted exept this one close routine that closes the applicataion.

What i am going to attach is what the vb6 code was. I ran the conversion tool and it is giving me this error that you see in the code snippet. I need to know what to put in the place of the "cancel" or if that is not the fix I need to know what is. The "Cancel" statement is what it is barking about..
Private Sub frmSpecialMailout_FormClosed(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
		If Me.cmdStart.Enabled = False Then
       MsgBox("App is currently running.  Please wait for App to stop.")
'UPGRADE_ISSUE: Event parameter Cancel was not upgraded. 
                      Cancel = 1
		Else
		   Me.Close()
		End If
		
		
	End Sub

Open in new window

0
Comment
Question by:lvandevender2008
3 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 22777323
Hi lvandevender2008,

You need to use the FormClosing event, because by the time it gets to the FormClosed event it's too late to cancel.

Regards,

Wayne
    Private Sub frmSpecialMailout_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If Me.cmdStart.Enabled = False Then
            MsgBox("App is currently running.  Please wait for App to stop.")
            e.Cancel = True
        Else
            Me.Close()
        End If
    End Sub

Open in new window

0
 
LVL 13

Expert Comment

by:TechTiger007
ID: 22777397
First thing is that you should not be doing this validation in form_closed event. You should be doing in Form_Closing event

Private Sub frmSpecialMailout_FormClosing(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosing
                If Me.cmdStart.Enabled = False Then
       MsgBox("App is currently running.  Please wait for App to stop.")
'UPGRADE_ISSUE: Event parameter Cancel was not upgraded.
                      eventArgs.Cancel = true
                Else
                   Me.Close()
                End If
               
               
        End Sub


0
 

Author Closing Comment

by:lvandevender2008
ID: 31508775
Best answer of the two. I tried both sets of code and this one was the only one that compilied correctly and worked. Good job man!!!!
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Formula for calculating ROI on training 6 49
Very Large data in MYSQL 7 73
bound data table problem 2 33
Import MySQL data into MS Access using VB.Net interface 5 29
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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