[Gambas-user] App.Major Version

Bruce bbruen at ...2308...
Fri Nov 8 14:04:52 CET 2013


On Fri, 2013-11-08 at 10:37 +0100, Alain Baudrez wrote:
> Hoi,
> 
> put those in a class
> 
> ' Gambas class file : clsVerion
> ' Version Info
> '
> ' Call as follows:
> ' DIM cVersion as new clsVersion
> '
> ' Print cVersion.VersionMajor & "." & cVersion.VersionMinor & " Build # " &
> cVersion.Build
> '
> Property Read Version                           ' Full version eg. 1.2.39
> Property Read VersionMajor As String     ' Major part    eg. 1
> Property Read VersionMinor As String     ' Minor Part    eg. 2
> Property Read VersionSmall As String    ' Major and Minor eg. 1.2
> Property Read Build As String                ' Revision eg. 39
> 
> Private Versie As String
> 
> Public Sub _new()
> 
>   Versie = Application.Version
> 
> End
> 
> Private Function Version_Read() As String
> 
>   Return Versie
> 
> End
> 
> Private Function VersionMajor_Read() As String
> 
>   Return Left(Versie, InStr(Versie, ".") - 1)
> 
> End
> 
> Private Function VersionMinor_Read() As String
> 
>   Return Mid(versie, InStr(Versie, ".") + 1, RInStr(Versie, ".") -
> InStr(Versie, ".") - 1)
> 
> End
> 
> Private Function Build_Read() As String
> 
>   Return Right(Versie, RInStr(Versie, ".") - 2)
> 
> End
> 
> Private Function VersionSmall_Read() As String
> 
>   Return Left(Versie, RInStr(Versie, ".") - 1)
> 
> End
> ' ============= End of Class =============
> 
> 
> 
> 
> *Alain J. Baudrez*
> a.baudrez at ...626...
> Tel: +32(0)486485080
> 
> *Personal Homepage:* http://baudrez.be
> http://facebook.com/abaudrez - http://twitter.com/abaudrez -
> http://about.me/abaudrez
> Webmaster cibliga.be - dierenartsrogiest.be
> 
> 
> 
> 2013/11/8 Riaan Pretorius <pretorius.riaan at ...626...>
> 
> > Good Day,
> >
> > I was wondering if the equivalent of App.Major  (vb6) exists in Gambas?
> >
> > Example:
> >
> > ' Visual Basic 6.0
> >
> > Label1.Caption = "Version: " & App.Major & "." & App.Minor & "." _
> >
> > & App.Revision
> >
> >
> > Riaan
> >


Ow Alain, my poor fingers!

How about just

        Application.Version.Split(".")[0] ' for the major
        Application.Version.Split(".")[1] ' for the minor
        Application.Version.Split(".")[2] ' for the revision
        
or for your OP's example

        Label1.Caption = "Version: " & Application.Version
        
:-)

Bruce





More information about the User mailing list