indy500fan
asked on
Setting Version and Date Information - Syntax help needed.
Friends,
I have the following code:
Imports System.IO.FileInfo
Public Class VersionInformation
Inherits System.Windows.Forms.Form
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
End Sub
Private Sub VersionInformation_Load(By Val sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myAssemblyPath As String
Dim a As Reflection.Assembly = _
System.Reflection.Assembly .GetExecut ingAssembl y()
myAssemblyPath = _
a.Location.Substring(0, InStrRev(a.Location, "\"))
Dim fileInfo = new FileInfo(Assembly.GetExecu tingAssemb ly().Locat ion ) <--------- I'm getting an error, Assembly - Expression expected
lblVersion.Text= System.Diagnostics.FileVer sionInfo.G etVersionI nfo(Assemb ly.GetExec utingAssem bly().Loca tion) <--------- I'm getting an error, Assembly - Expression expected
lblDate.text = <---------- What does I need to put here to get the Date Modified?
End Sub
End Class
This code was given to me by another poster, but I'm not sure how to tie it all together, and I'm in a hurry for a response.
Thanks in advance!
Best Regards,
Eric
I have the following code:
Imports System.IO.FileInfo
Public Class VersionInformation
Inherits System.Windows.Forms.Form
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
End Sub
Private Sub VersionInformation_Load(By
Dim myAssemblyPath As String
Dim a As Reflection.Assembly = _
System.Reflection.Assembly
myAssemblyPath = _
a.Location.Substring(0, InStrRev(a.Location, "\"))
Dim fileInfo = new FileInfo(Assembly.GetExecu
lblVersion.Text= System.Diagnostics.FileVer
lblDate.text = <---------- What does I need to put here to get the Date Modified?
End Sub
End Class
This code was given to me by another poster, but I'm not sure how to tie it all together, and I'm in a hurry for a response.
Thanks in advance!
Best Regards,
Eric
ASKER
??? I can't tell you that, because this won't even compile as it is. By the way, what is GAC?
GAC is Global Assembly Cache. If more than one application on your machine is using the same component, you can palce that component to GAC
one of the benefits of doing that is that if you make a change to that component, you won't need to go into every application that uses the component and replace the local copy with an updated version. Using GAC saves you from "DLL Hell" we had in VB6
ASKER
From what is described here: I don't think I have multiple apps using this component. This all seems very complicated (compounded by my stupidity)
This form is a part of a simple exe. Is there an easier way to find out the file version and date of the exe so that I can display them in an about form?
This form is a part of a simple exe. Is there an easier way to find out the file version and date of the exe so that I can display them in an about form?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Justin,
Yeah, sorry I didn't specify the type of error earlier.
It's now giving me another compliation error:
Value of type 'System.Diagnostics.FileVe rsionInfo' cannot be converted to 'String'.
Yeah, sorry I didn't specify the type of error earlier.
It's now giving me another compliation error:
Value of type 'System.Diagnostics.FileVe
lblVersion.Text = System.Diagnostics.FileVer sionInfo.G etVersionI nfo(System .Reflectio n.Assembly .GetExecut ingAssembl y().Locati on).ToStri ng()
ASKER
Justin,
You have gotten me closer than anyone else today, but this code gives me The exact path to the exe, not the file version number?
Am I driving you nuts yet?
Thanks,
Eric
You have gotten me closer than anyone else today, but this code gives me The exact path to the exe, not the file version number?
Am I driving you nuts yet?
Thanks,
Eric
ASKER
Ah, I just realized, it actually gave me all the information. I didn't have a lbl box that was "tall enough"
I'm going to ask in another question a way to limit it to just the version number.
Thanks for your help!
I'm going to ask in another question a way to limit it to just the version number.
Thanks for your help!
Imports System.IO
Imports System
Imports System.Reflection
Public Class VersionInformation
Inherits System.Windows.Forms.Form
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
End Sub
Private Sub VersionInformation_Load(By Val sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myAssemblyPath As String
Dim a As Reflection.Assembly = _
System.Reflection.Assembly .GetExecut ingAssembl y()
myAssemblyPath = _
a.Location.Substring(0, InStrRev(a.Location, "\"))
Dim fi As System.IO.FileInfo = New FileInfo(System.Reflection .Assembly. GetExecuti ngAssembly ().Locatio n)
Dim loc As String = System.Reflection.Assembly .GetExecut ingAssembl y().Locati on
lblVersion.Text = System.Diagnostics.FileVer sionInfo.G etVersionI nfo(loc).F ileVersion
lblDate.text = fi.LastWriteTime.ToString( )
End Sub
End Class
Imports System
Imports System.Reflection
Public Class VersionInformation
Inherits System.Windows.Forms.Form
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
End Sub
Private Sub VersionInformation_Load(By
Dim myAssemblyPath As String
Dim a As Reflection.Assembly = _
System.Reflection.Assembly
myAssemblyPath = _
a.Location.Substring(0, InStrRev(a.Location, "\"))
Dim fi As System.IO.FileInfo = New FileInfo(System.Reflection
Dim loc As String = System.Reflection.Assembly
lblVersion.Text = System.Diagnostics.FileVer
lblDate.text = fi.LastWriteTime.ToString(
End Sub
End Class
ASKER
Dude,
You rock!
Thank you VERY MUCH!!!
Eric
You rock!
Thank you VERY MUCH!!!
Eric
You're welcome!
What is the actual value returned by "Assembly.GetExecutingAsse