Class Property not Returning

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cday119
    New Member
    • Mar 2008
    • 29

    Class Property not Returning

    I have a Class with about 10 properties. All properties return right except for one. It is real annoying and I can't see why its not working. Maybe someone else can see something. It is the NumberLines property. I can set it to 4 but when it returns it is set to 1

    [CODE=vbnet]
    Public Class Profile

    Private ProfileFileName As String
    Private ProfileDescript ion As String
    Private ProfileVersion As Integer
    Private ProfileNumAutoR eduction As Integer
    Private ProfileNumberLi nes As Integer
    Private ProfilePrinterN ame As String
    Private ProfilePrintOri entation As String
    Private ProfilePaperSiz e As Integer
    Private ProfileColumnsP erPage As Integer
    Private ProfileRowsPerP age As Integer
    Private ProfileHorizont alDisplacement As Integer
    Private ProfileVertical Displacement As Integer
    Private ProfileHorizont alSeperation As Integer
    Private ProfileVertical Seperation As Integer
    Private ProfileLines As New Collection

    Public Sub New()
    'This how sub sets the defaults of the default profile.
    Me.Description = "New Profile"
    Me.Version = 2
    Me.NumAutoReduc tion = 4
    Me.NumberLines = 4
    Me.PrintOrienta tion = 44
    Me.PaperSize = 260
    Me.ColumnsPerPa ge = 1
    Me.RowsPerPage = 1
    Me.HorizontalDi splacement = 0
    Me.VerticalDisp lacement = 0
    Me.HorizontalSe peration = 0
    Me.VerticalSepe ration = 0

    Dim Line As Collection = New Collection
    Dim Line2 As Collection = New Collection
    Dim Line3 As Collection = New Collection
    Dim Line4 As Collection = New Collection
    Dim Reduction As Collection = New Collection
    Dim Reduction2 As Collection = New Collection
    Dim Reduction3 As Collection = New Collection
    Dim Reduction4 As Collection = New Collection
    Dim Reduction5 As Collection = New Collection

    Dim i As Integer = 1

    Reduction.Add(" True", "Enabled")
    Reduction.Add(" 24", "Size")
    Reduction.Add(" Arial", "Font")
    Reduction2.Add( "18", "Size")
    Reduction2.Add( "Arial", "Font")
    Reduction3.Add( "16", "Size")
    Reduction3.Add( "Arial Narrow", "Font")
    Reduction4.Add( "14", "Size")
    Reduction4.Add( "Arial Narrow", "Font")
    Reduction5.Add( "12", "Size")
    Reduction5.Add( "Arial Narrow", "Font")
    Line.Add(Reduct ion, "Reduction1 ")
    Line.Add(Reduct ion2, "Reduction2 ")
    Line.Add(Reduct ion3, "Reduction3 ")
    Line.Add(Reduct ion4, "Reduction4 ")
    Line2.Add(Reduc tion2, "Reduction1 ")
    Line2.Add(Reduc tion3, "Reduction2 ")
    Line2.Add(Reduc tion4, "Reduction3 ")
    Line2.Add(Reduc tion5, "Reduction4 ")
    Line3.Add(Reduc tion3, "Reduction1 ")
    Line3.Add(Reduc tion4, "Reduction2 ")
    Line3.Add(Reduc tion5, "Reduction3 ")
    Line3.Add(Reduc tion5, "Reduction4 ")
    Line4.Add(Reduc tion4, "Reduction1 ")
    Line4.Add(Reduc tion5, "Reduction2 ")
    Line4.Add(Reduc tion5, "Reduction3 ")
    Line4.Add(Reduc tion5, "Reduction4 ")

    Me.Lines.Add(Li ne, "Line1")
    Me.Lines.Add(Li ne2, "Line2")
    Me.Lines.Add(Li ne3, "Line3")
    Me.Lines.Add(Li ne4, "Line4")

    MsgBox(ProfileN umberLines)
    End Sub

    Property Description() As String
    Get
    Return ProfileDescript ion
    End Get
    Set(ByVal value As String)
    ProfileDescript ion = value
    End Set
    End Property

    Property FileName() As String
    Get
    Return ProfileFileName
    End Get
    Set(ByVal value As String)
    ProfileFileName = value
    End Set
    End Property

    Property Version() As Integer
    Get
    Return ProfileVersion
    End Get
    Set(ByVal value As Integer)
    ProfileVersion = value
    End Set
    End Property

    Property NumAutoReductio n() As Integer
    Get
    Return ProfileNumAutoR eduction
    End Get
    Set(ByVal value As Integer)
    ProfileNumAutoR eduction = value
    End Set
    End Property

    Property PrinterName() As String
    Get
    Return ProfilePrinterN ame
    End Get
    Set(ByVal value As String)
    ProfilePrinterN ame = value
    End Set
    End Property

    Property PrintOrientatio n() As String
    Get
    Return ProfilePrintOri entation
    End Get
    Set(ByVal value As String)
    ProfilePrintOri entation = value
    End Set
    End Property

    Property PaperSize() As Integer
    Get
    Return ProfilePaperSiz e
    End Get
    Set(ByVal value As Integer)
    ProfilePaperSiz e = value
    End Set
    End Property

    Property ColumnsPerPage( ) As Integer
    Get
    Return ProfileColumnsP erPage
    End Get
    Set(ByVal value As Integer)
    ProfileColumnsP erPage = value
    End Set
    End Property

    Property RowsPerPage() As Integer
    Get
    Return ProfileRowsPerP age
    End Get
    Set(ByVal value As Integer)
    ProfileRowsPerP age = value
    End Set
    End Property

    Property HorizontalDispl acement() As Integer
    Get
    Return ProfileHorizont alDisplacement
    End Get
    Set(ByVal value As Integer)
    ProfileHorizont alDisplacement = value
    End Set
    End Property

    Property VerticalDisplac ement() As Integer
    Get
    Return ProfileVertical Displacement
    End Get
    Set(ByVal value As Integer)
    ProfileVertical Displacement = value
    End Set
    End Property

    Property HorizontalSeper ation() As Integer
    Get
    Return ProfileHorizont alSeperation
    End Get
    Set(ByVal value As Integer)
    ProfileHorizont alSeperation = value
    End Set
    End Property

    Property VerticalSeperat ion() As Integer
    Get
    Return ProfileVertical Seperation
    End Get
    Set(ByVal value As Integer)
    ProfileVertical Seperation = value
    End Set
    End Property

    Public Property Lines() As Collection
    Get
    Return ProfileLines
    End Get
    Set(ByVal value As Collection)
    ProfileLines = value
    End Set
    End Property

    Property NumberLines() As Integer
    Get
    Return ProfileNumberLi nes
    End Get
    Set(ByVal value As Integer)
    ProfileNumberLi nes = value
    End Set
    End Property

    End Class
    [/CODE]

    And this is how a call a new Profile
    Code:
    Public Class frmPageSetup
    
    Public Shared Profile As New Profile()
  • cday119
    New Member
    • Mar 2008
    • 29

    #2
    It figures, I've been struggling with this one for awhile and just found the problem. I have an onChange event that was triggered when the profile was loaded that set the NumberLines to 1.

    Sorry Gang

    Comment

    Working...