Can I save all this code by calling the Showdialog method instead?

Heavenly

Well-known member
Joined
Aug 22, 2005
Messages
53
Location
Puerto Rico
Programming Experience
1-3
Can I save all this code by calling the Showdialog method instead?





I have 25 forms in the project, since this is a Kiosk application all forms NEED to be close before moving on to the next.





QUESTION:

Can I save all this code?
VB.NET:
[color=blue][font='Courier New']If[/font][/color][font='Courier New'] IsNothing(FormCancelarCard) = [color=blue]False[/color] [color=blue]Then[/color][/font]

[font='Courier New']			[color=blue]If[/color] FormCancelarCard.IsDisposed = [color=blue]False[/color] [color=blue]Then[/color][/font]

[font='Courier New']			[color=blue]Else[/color][/font]

[font='Courier New']				PlaySound()[/font]

[font='Courier New']				FormCancelarCard = [color=blue]New[/color] Cancelar_Card[/font]

[font='Courier New']				FormCancelarCard.Show()[/font]

[font='Courier New']			[color=blue]End[/color] [color=blue]If[/color][/font]

[font='Courier New']		[color=blue]Else[/color][/font]

[font='Courier New'] 		   PlaySound()[/font]

[font='Courier New']			FormCancelarCard = [color=blue]New[/color] Cancelar_Card[/font]

[font='Courier New']			FormCancelarCard.Show()[/font]

[font='Courier New']		[color=blue]End[/color] [color=blue]If[/color][/font]

[font='Courier New']		FormSeleccion2.Close()[/font]


and use this instead:
VB.NET:
[font='Courier New']	[color=blue]Private[/color] [color=blue]Sub[/color] Button99_Click([color=blue]ByVal[/color] sender [color=blue]As[/color] System.Object, [color=blue]ByVal[/color] e [color=blue]As[/color] System.EventArgs) [color=blue]Handles[/color] Button99.Click[/font]

[font='Courier New']		FormCancelarCard.ShowDialog()[/font]

[font='Courier New']		[color=blue]Me[/color].Close()[/font]

[font='Courier New']	[color=blue]End[/color] [color=blue]Sub[/color][/font]


…with this in modMain:

VB.NET:
[font='Courier New'] [color=blue]Friend[/color] FormCancelarCard [color=blue]As[/color] [color=blue]New[/color] Cancelar_Card[/font]

Is this correct or not?
 
Back
Top