Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm starting to go bonkers here so anyone that can help this relative newbie please do so.

 

 

I'm working on a splash screen for our application and while loading it I want to show:

- company name

- application name

- application version

 

 

I know I can use AssemblyInfo.vb for this but I have no idea how.

 

The application consists of a couple of projects and the AssemblyInfo.vb file is located in project that loads first.

In this project are also my Main.vb and frmSplash.vb

 

What I had in my frmSplash.vb is:

 

Imports System.Reflection

Public Class frmSplash
Inherits System.Windows.Forms.Form

Public Sub SetStatus(ByVal sMessage As String)

Dim test as [Assembly]

test.LoadWithPartialName("AssemblyInfo")

End Sub


....... (form stuff)


End Class

 

 

After this how do I access any of the items in the standard AssemblyInfo.vb file?

 

 

 

Seeing as I couldn't get this to work I've also tried a different way .. now at least I can get the application version, but neither the companyname nor the application name since neither is associated with my *.exe file.

 

My alternative splash coding is as follows:

 

 

Public Class frmSplash
   Inherits System.Windows.Forms.Form

   Public Sub SetStatus(ByVal sMessage As String)

   Dim UtilisInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath)

       Me.lblUtilis.Text = "Versie " & UtilisInfo.FileMajorPart & "." & UtilisInfo.FileMinorPart _
                       & "   Build " & UtilisInfo.FileBuildPart

   End Sub


........ (form stuff)

End Class

 

 

If I go this road how can I associate the company name & application name with my executable?

 

 

 

 

P.S. I've browsed through this forum extensively and read everything I found about loading the assembly etc, but still don't understand one bit how to apply it, so have some patience if I ask silly questions.

  • *Gurus*
Posted

Dim a As Reflection.AssemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName()

 

You can then use the various methods of a to find out the version of your assembly easily.

 

As for company name and product name,

 

Application.CompanyName
Application.ProductName

 

Will do the job. You can ignore the AssemblyInfo.vb file, that's just where you specify them for the compiler, not how to retreive them back at runtime.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

Can't test what you posted since I'm at home, but my main concern with that method is:

where do tell my application what it's company and productname are?

 

I already figured out the bit about Application.CompanyName etc ... but when trying to compile things I got one of those NullReference-errors (or whatever the exact text is), so I know that there's no info to be gotten.

(This is why I started looking into using the AssemblyInfo.vb)

 

 

I've searched high and low and while with my limited VB6 experience I can there easily find where to put that info, I haven't yet found it in .NET .... all I've found is where I can specify the ... erm ... if memory serves me the applicationname (using "Property Pages" in the Solution Explorer).

Posted

That's just it ... even when I filled in stuff in the AssemblyInfo.vb file I couldn't access it with Application.CompanyName etc.

 

 

I have however solved the problem by using something similar to your "Dim a As ..." statement and then by walking through all the objects in my assembly file and when I find the right assembly type I associate the value of the object with my variable.

 

 

 

Thanks for the input.

 

 

Oh yeah, now that I think of it ... any idea why the copyright-object from the standard AssemblyInfo.vb file gives as type System.Diagnostics.Debuggable instead of System.Reflection.AssemblyCopyrightAttribute as it should give?

 

Is that some sort of bug?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...