showing the version number in a labels text

  • Thread starter Thread starter The One
  • Start date Start date
T

The One

I would like to know how I can show the version number of my program in the text
for a label on a windows form.

I'm not sure whether it is possible using visual basic standard 2002

any help would be greatly appreciated.

thanks.
 
Hi The One,
I would like to know how I can show the version number of my program in the text
for a label on a windows form.

I'm not sure whether it is possible using visual basic standard 2002
I dont know that either, but I should not know why not.

Put this in your form
\\\
Dim meAssem As New AssemblyInfo
label=meAssem.Version
///
And this on the end of your assembly.vb
\\\
Public Class AssemblyInfo
Private myType As Type
Public Sub New()
myType = GetType(form1) ' assuming your main form is form1
End Sub
Public ReadOnly Property Version() As String
Get
Return myType.Assembly.GetName.Version.ToString()
End Get
End Property
End Class
///
I hope this helps a little bit?
Cor
 
Hi One,

Here's a wee selection:

Dim S$

S$ = Application.ProductVersion

S$ = System.Diagnostics. _
FileVersionInfo.GetVersionInfo _
(Application.ExecutablePath).ProductVersion

S$ = System.Reflection. _
Assembly.GetExecutingAssembly.GetName().Version.ToString

lblVersion.Text = S$

Regards,
Fergus
 
Hi Herfried,

*grrr*

ROFLMAO

I converted a QBasic program the other day and discovered just how retro
VB.NET really is - so few errors!!

I was just <waiting> for a time when I could use that old syntax in an
unimportant way. I was hoping you'd tell I couldn't use S$ but *grrr* is just
as funny. ;-))

Regards,
Fergus
 
* "Fergus Cooney said:
I converted a QBasic program the other day and discovered just how retro
VB.NET really is - so few errors!!

I was just <waiting> for a time when I could use that old syntax in an
unimportant way. I was hoping you'd tell I couldn't use S$ but *grrr* is just
as funny. ;-))

Some people would say that using type suffices is "bad practice".

;-)
 
Hi Herfried,

|| Some people would say that using type suffices is "bad practice".

LOL, That's a mild version of what I thought you'd say. I think using $,
%, etc is awful - in a new program - but acceptable in legacy programs.

Regards,
Fergus
 
* "Fergus Cooney said:
LOL, That's a mild version of what I thought you'd say. I think using $,
%, etc is awful - in a new program - but acceptable in legacy programs.

ACK.
 
thanks for that it works fine.

Cor said:
Hi The One,
I dont know that either, but I should not know why not.

Put this in your form
\\\
Dim meAssem As New AssemblyInfo
label=meAssem.Version
///
And this on the end of your assembly.vb
\\\
Public Class AssemblyInfo
Private myType As Type
Public Sub New()
myType = GetType(form1) ' assuming your main form is form1
End Sub
Public ReadOnly Property Version() As String
Get
Return myType.Assembly.GetName.Version.ToString()
End Get
End Property
End Class
///
I hope this helps a little bit?
Cor
 
Back
Top