Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2005, 01:05 PM
Authorized User
 
Join Date: Jun 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to put the version number i'm working on

Hello,

I need to show the last version number of my web application in a label on my main webform. Is there any method or something similar that can give it to me, instead of calculation it from am initial file? I'm not sure if it's clear for you what i want...

Thank you,


Elisa Resina
__________________
Elisa Resina
 
Old January 6th, 2005, 01:09 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Try this:
Code:
using System.Reflection;
...
...
(Later)
  Assembly SampleAssembly;
  // Instantiate a target object.
  Int32 Integer1 = new Int32();
  Type Type1;
  // Set the Type instance to the target class type.
  Type1 = Integer1.GetType();
  // Instantiate an Assembly class to the assembly housing the Integer type.  
   SampleAssembly = Assembly.GetAssembly(Integer1.GetType());
  // Display the name of the assembly currently executing
  string theVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
      lblVersion.Text = theVersion;
HtH,

Imar
 
Old January 6th, 2005, 01:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Or much shorter and simpler:

lblVersion = System.Reflection.Assembly.GetExecutingAssembly(). GetName().Version.ToString();

Imar





Similar Threads
Thread Thread Starter Forum Replies Last Post
Why data-type="number" not working here... akentanaka XSLT 6 July 12th, 2008 07:13 PM
existing dll version number arifsharif_2001 Visual Studio 2005 0 May 17th, 2007 02:21 AM
Php code to put&get images from mysql not working! angelbeans PHP Databases 1 September 8th, 2006 12:44 PM
Getting the Version number at Runtime Pallavs20 .NET Framework 2.0 2 September 29th, 2005 09:52 AM
put a limit on the number of characters entered in crmpicco HTML Code Clinic 6 April 12th, 2005 06:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.