473,378 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Class Property not Returning

29
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

Expand|Select|Wrap|Line Numbers
  1. Public Class Profile
  2.  
  3.     Private ProfileFileName As String
  4.     Private ProfileDescription As String
  5.     Private ProfileVersion As Integer
  6.     Private ProfileNumAutoReduction As Integer
  7.     Private ProfileNumberLines As Integer
  8.     Private ProfilePrinterName As String
  9.     Private ProfilePrintOrientation As String
  10.     Private ProfilePaperSize As Integer
  11.     Private ProfileColumnsPerPage As Integer
  12.     Private ProfileRowsPerPage As Integer
  13.     Private ProfileHorizontalDisplacement As Integer
  14.     Private ProfileVerticalDisplacement As Integer
  15.     Private ProfileHorizontalSeperation As Integer
  16.     Private ProfileVerticalSeperation As Integer
  17.     Private ProfileLines As New Collection
  18.  
  19.     Public Sub New()
  20.         'This how sub sets the defaults of the default profile.
  21.         Me.Description = "New Profile"
  22.         Me.Version = 2
  23.         Me.NumAutoReduction = 4
  24.         Me.NumberLines = 4
  25.         Me.PrintOrientation = 44
  26.         Me.PaperSize = 260
  27.         Me.ColumnsPerPage = 1
  28.         Me.RowsPerPage = 1
  29.         Me.HorizontalDisplacement = 0
  30.         Me.VerticalDisplacement = 0
  31.         Me.HorizontalSeperation = 0
  32.         Me.VerticalSeperation = 0
  33.  
  34.         Dim Line As Collection = New Collection
  35.         Dim Line2 As Collection = New Collection
  36.         Dim Line3 As Collection = New Collection
  37.         Dim Line4 As Collection = New Collection
  38.         Dim Reduction As Collection = New Collection
  39.         Dim Reduction2 As Collection = New Collection
  40.         Dim Reduction3 As Collection = New Collection
  41.         Dim Reduction4 As Collection = New Collection
  42.         Dim Reduction5 As Collection = New Collection
  43.  
  44.         Dim i As Integer = 1
  45.  
  46.         Reduction.Add("True", "Enabled")
  47.         Reduction.Add("24", "Size")
  48.         Reduction.Add("Arial", "Font")
  49.         Reduction2.Add("18", "Size")
  50.         Reduction2.Add("Arial", "Font")
  51.         Reduction3.Add("16", "Size")
  52.         Reduction3.Add("Arial Narrow", "Font")
  53.         Reduction4.Add("14", "Size")
  54.         Reduction4.Add("Arial Narrow", "Font")
  55.         Reduction5.Add("12", "Size")
  56.         Reduction5.Add("Arial Narrow", "Font")
  57.         Line.Add(Reduction, "Reduction1")
  58.         Line.Add(Reduction2, "Reduction2")
  59.         Line.Add(Reduction3, "Reduction3")
  60.         Line.Add(Reduction4, "Reduction4")
  61.         Line2.Add(Reduction2, "Reduction1")
  62.         Line2.Add(Reduction3, "Reduction2")
  63.         Line2.Add(Reduction4, "Reduction3")
  64.         Line2.Add(Reduction5, "Reduction4")
  65.         Line3.Add(Reduction3, "Reduction1")
  66.         Line3.Add(Reduction4, "Reduction2")
  67.         Line3.Add(Reduction5, "Reduction3")
  68.         Line3.Add(Reduction5, "Reduction4")
  69.         Line4.Add(Reduction4, "Reduction1")
  70.         Line4.Add(Reduction5, "Reduction2")
  71.         Line4.Add(Reduction5, "Reduction3")
  72.         Line4.Add(Reduction5, "Reduction4")
  73.  
  74.         Me.Lines.Add(Line, "Line1")
  75.         Me.Lines.Add(Line2, "Line2")
  76.         Me.Lines.Add(Line3, "Line3")
  77.         Me.Lines.Add(Line4, "Line4")
  78.  
  79.         MsgBox(ProfileNumberLines)
  80.     End Sub
  81.  
  82.     Property Description() As String
  83.         Get
  84.             Return ProfileDescription
  85.         End Get
  86.         Set(ByVal value As String)
  87.             ProfileDescription = value
  88.         End Set
  89.     End Property
  90.  
  91.     Property FileName() As String
  92.         Get
  93.             Return ProfileFileName
  94.         End Get
  95.         Set(ByVal value As String)
  96.             ProfileFileName = value
  97.         End Set
  98.     End Property
  99.  
  100.     Property Version() As Integer
  101.         Get
  102.             Return ProfileVersion
  103.         End Get
  104.         Set(ByVal value As Integer)
  105.             ProfileVersion = value
  106.         End Set
  107.     End Property
  108.  
  109.     Property NumAutoReduction() As Integer
  110.         Get
  111.             Return ProfileNumAutoReduction
  112.         End Get
  113.         Set(ByVal value As Integer)
  114.             ProfileNumAutoReduction = value
  115.         End Set
  116.     End Property
  117.  
  118.     Property PrinterName() As String
  119.         Get
  120.             Return ProfilePrinterName
  121.         End Get
  122.         Set(ByVal value As String)
  123.             ProfilePrinterName = value
  124.         End Set
  125.     End Property
  126.  
  127.     Property PrintOrientation() As String
  128.         Get
  129.             Return ProfilePrintOrientation
  130.         End Get
  131.         Set(ByVal value As String)
  132.             ProfilePrintOrientation = value
  133.         End Set
  134.     End Property
  135.  
  136.     Property PaperSize() As Integer
  137.         Get
  138.             Return ProfilePaperSize
  139.         End Get
  140.         Set(ByVal value As Integer)
  141.             ProfilePaperSize = value
  142.         End Set
  143.     End Property
  144.  
  145.     Property ColumnsPerPage() As Integer
  146.         Get
  147.             Return ProfileColumnsPerPage
  148.         End Get
  149.         Set(ByVal value As Integer)
  150.             ProfileColumnsPerPage = value
  151.         End Set
  152.     End Property
  153.  
  154.     Property RowsPerPage() As Integer
  155.         Get
  156.             Return ProfileRowsPerPage
  157.         End Get
  158.         Set(ByVal value As Integer)
  159.             ProfileRowsPerPage = value
  160.         End Set
  161.     End Property
  162.  
  163.     Property HorizontalDisplacement() As Integer
  164.         Get
  165.             Return ProfileHorizontalDisplacement
  166.         End Get
  167.         Set(ByVal value As Integer)
  168.             ProfileHorizontalDisplacement = value
  169.         End Set
  170.     End Property
  171.  
  172.     Property VerticalDisplacement() As Integer
  173.         Get
  174.             Return ProfileVerticalDisplacement
  175.         End Get
  176.         Set(ByVal value As Integer)
  177.             ProfileVerticalDisplacement = value
  178.         End Set
  179.     End Property
  180.  
  181.     Property HorizontalSeperation() As Integer
  182.         Get
  183.             Return ProfileHorizontalSeperation
  184.         End Get
  185.         Set(ByVal value As Integer)
  186.             ProfileHorizontalSeperation = value
  187.         End Set
  188.     End Property
  189.  
  190.     Property VerticalSeperation() As Integer
  191.         Get
  192.             Return ProfileVerticalSeperation
  193.         End Get
  194.         Set(ByVal value As Integer)
  195.             ProfileVerticalSeperation = value
  196.         End Set
  197.     End Property
  198.  
  199.     Public Property Lines() As Collection
  200.         Get
  201.             Return ProfileLines
  202.         End Get
  203.         Set(ByVal value As Collection)
  204.             ProfileLines = value
  205.         End Set
  206.     End Property
  207.  
  208.     Property NumberLines() As Integer
  209.         Get
  210.             Return ProfileNumberLines
  211.         End Get
  212.         Set(ByVal value As Integer)
  213.             ProfileNumberLines = value
  214.         End Set
  215.     End Property
  216.  
  217. End Class
  218.  
And this is how a call a new Profile
Expand|Select|Wrap|Line Numbers
  1. Public Class frmPageSetup
  2.  
  3. Public Shared Profile As New Profile()
  4.  
Apr 4 '08 #1
1 1332
cday119
29
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
Apr 4 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: SACHIN | last post by:
I have this class as part of a Consol application. using System; namespace Bugreport { /// <summary> /// This class tries to use the Class/Struct combination. /// </summary> class Class1 {
166
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
5
by: Jeff Bunting | last post by:
I'm trying to serialize a class I have and have been getting: An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll There was an error reflecting type...
1
by: Scott Collens | last post by:
Hello, I am having issues returning the results from the database using a data access class. The class is called dbconnect.vb. Imports System Imports System.Data Imports System.Data.SqlClient
3
by: Trammel | last post by:
Hi, I recently upgraded to VB.net from VB6.. and woah... I feel lost :¬O One of my reasons for upgrading is I was told that VB.net can do class inheritance and subclassing easier. ...
6
by: thomasp | last post by:
For those who gave advice on the shortfalls of my first attempt at writing a vb.net class, Thank You. I hope that I was able to apply some of your advice to this larger atempt. At first I didn' t...
3
by: shapper | last post by:
Hello, I created a simple class as follows: Public Class HelloWorld Public Function SayMessage() As String Return "Hello World!" End Function
20
by: tshad | last post by:
Using VS 2003, I am trying to take a class that I created to create new variable types to handle nulls and track changes to standard variable types. This is for use with database variables. This...
3
by: Alessandro [AkiRoss] Re | last post by:
Hello, I'm trying to to this: all classes of a hierarchy have a property, which is a constant object shared between each class. I'd like to have one function for getting that object, but each...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.