newbee question on VB.Net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am working on a VB.Net project created by other people. The project is a
window application.

I have the following questions:
(1) What do the following codes mean:
Me.Close()
Me.Dispose()

(2) How do I prevent a window form from being closed?
In VB 6, I will do cancel = false in the form_unload.

(3) How do I determine the application verion at runtime.
In VB 6, I can do app.Major & "." & App.Minor & "." & App.Revision


TIA
 
Ed Chiu said:
Hi,

I am working on a VB.Net project created by other people. The project is a
window application.

I have the following questions:
(1) What do the following codes mean:
Me.Close()

Close the window (I'm assuming Me is a Form class).
Me.Dispose()

Dispose the window resources (closing internal Window Handles and suchlike)
(2) How do I prevent a window form from being closed?
In VB 6, I will do cancel = false in the form_unload.

Set e.Cancel = True in the Form.Closing event.
 
Ed,

Ed Chiu said:
I am working on a VB.Net project created by other people. The project is a
window application.

I have the following questions:
(1) What do the following codes mean:
Me.Close()
Me.Dispose()

This code means that the form currently executing is closed and disposed.
Disposing is not necessary if the form is shown by calling its 'Show'
method, but it's necessary when calling 'ShowDialog'. In the latter case I
would not call 'Dispose' inside the form. Instead the user of the form
should call 'Dispose':

\\\
Dim f As New FooForm()
f.ShowDialog()
f.Dispose()
///
(2) How do I prevent a window form from being closed?
In VB 6, I will do cancel = false in the form_unload.

\\\
Imports System.ComponentModel
..
..
..
Private Sub Form1_Closing( _
ByVal sender As Object, _
ByVal e As CancelEventArgs _
) Handles MyBase.Closing
If...Then
e.Cancel = True
End If
End Sub
///
(3) How do I determine the application verion at runtime.
In VB 6, I can do app.Major & "." & App.Minor & "." & App.Revision

Structure of version numbers and methods to determine the version number
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=versioning&lang=en>
 
Back
Top