Solved

vb6 code conversion to vb 2008

Posted on 2008-10-22
3
416 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

11 Experts available now in Live!

Get 1:1 Help Now