I am trying to create a class in Visual Basic 2005 environment to hold
all information closely together. There are two variables I want to use,
and they look like this:
*************** *************** *************** *************** **********
clsLayerZ1
|
+-Headers
| |
| +-Header1 = Text1 (String)
| +-Header2 = Text2 (String)
| +-....
+-LC(0)
| |
| +-ID = LC ID (Integer)
| +-Entity(0)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-Load2 = Value2 (Double)
| | +-Load3 = Value3 (Double)
| | +-....
| +-Entity(1)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-....
| +-....
+-LC(1)
| |
| +-ID = LC ID (Integer)
| +-....
+-....
*************** *************** *************** *************** **********
I currently have tried to do it this way:
*************** *************** *************** *************** **********
Public Class Layer
Private _iLCs As Integer
Private _iHeaders As Short
Private _iEntities As Long
Sub New(ByVal iLCs As Integer, ByVal iEntities As Long, ByVal
iHeaders As Short)
_iLCs = iLCs
_iEntities = iEntities
_iHeaders = iHeaders
ReDim _LoadCase(_iEnt ities)
End Sub
Public LoadCase(_iLCs) As LoadCase(_iEnti ties)
Public Headers(_iHeade rs) As String
End Class
Public Class LoadCase
Private _iEntities As Long
Sub New(ByVal iEntities As Long)
_iEntities = iEntities
End Sub
Public LCID As Long
Public Entities(_iEnti ties) As Entity(iLoadCom ponents)
End Class
Public Class Entity
Private _iLoadComponent s As Short
Sub New(ByVal iLoadComponents As Short)
_iLoadComponent s = iLoadComponents
End Sub
Public EntityID As Long
Public LoadsInfo(_iLoa dComponents) As Double
End Class
*************** *************** *************** *************** **********
Unfortunately, this method is not working for me. I probably have some
fundamental flaws in the code I'm trying to use, but I haven't got any
idea how to do this properly.
Another problem that I have: these variables are to be used in multiple
procedures, but one of these procedures generates the required
dimensions for the various sub-arrays in the class I want to create.
Hopefully someone is able to help me by perhaps providing me with a
decent example of how this is done.
Regards, CoRrRan 2 1332
On Jun 6, 9:34 am, CoRrRan <CoRrRan~NOSPAM ~@~NOSPAM~gmail .comwrote:
I am trying to create a class in Visual Basic 2005 environment to hold
all information closely together. There are two variables I want to use,
and they look like this:
*************** *************** *************** *************** **********
clsLayerZ1
|
+-Headers
| |
| +-Header1 = Text1 (String)
| +-Header2 = Text2 (String)
| +-....
+-LC(0)
| |
| +-ID = LC ID (Integer)
| +-Entity(0)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-Load2 = Value2 (Double)
| | +-Load3 = Value3 (Double)
| | +-....
| +-Entity(1)
| | |
| | +-ID = Entity ID (Integer)
| | +-Loads
| | |
| | +-Load1 = Value1 (Double)
| | +-....
| +-....
+-LC(1)
| |
| +-ID = LC ID (Integer)
| +-....
+-....
*************** *************** *************** *************** **********
I currently have tried to do it this way:
*************** *************** *************** *************** **********
Public Class Layer
Private _iLCs As Integer
Private _iHeaders As Short
Private _iEntities As Long
Sub New(ByVal iLCs As Integer, ByVal iEntities As Long, ByVal
iHeaders As Short)
_iLCs = iLCs
_iEntities = iEntities
_iHeaders = iHeaders
ReDim _LoadCase(_iEnt ities)
End Sub
Public LoadCase(_iLCs) As LoadCase(_iEnti ties)
Public Headers(_iHeade rs) As String
End Class
Public Class LoadCase
Private _iEntities As Long
Sub New(ByVal iEntities As Long)
_iEntities = iEntities
End Sub
Public LCID As Long
Public Entities(_iEnti ties) As Entity(iLoadCom ponents)
End Class
Public Class Entity
Private _iLoadComponent s As Short
Sub New(ByVal iLoadComponents As Short)
_iLoadComponent s = iLoadComponents
End Sub
Public EntityID As Long
Public LoadsInfo(_iLoa dComponents) As Double
End Class
*************** *************** *************** *************** **********
Unfortunately, this method is not working for me. I probably have some
fundamental flaws in the code I'm trying to use, but I haven't got any
idea how to do this properly.
Another problem that I have: these variables are to be used in multiple
procedures, but one of these procedures generates the required
dimensions for the various sub-arrays in the class I want to create.
Hopefully someone is able to help me by perhaps providing me with a
decent example of how this is done.
Regards, CoRrRan
Don't use arrays, instead use a List(Of LoadCase) and List(Of Entity)
respectively (If you dont have VB 2005, then use an ArrayList
instead). Then you don't have to pre-allocate the size. You can use
the .Add method to add entries to the list.
Something like this:
Public Class Layer
Sub New()
_loadCases = New List(Of LoadCase)
_headers = New List(Of String)
End Sub
Private _loadCases As List(Of LoadCase)
Public ReadOnly Property LoadCases As List(Of LoadCase)
Get
Return _loadCases
End Get
End Property
Private _headers As List(Of String)
Public ReadOnly Property Headers As List (Of String)
Get
Return _headers
End Get
End Property
End Class
You can use the class like this:
Public Class Form1 As Form
Private _layer As Layer
Public Sub New()
_layer = New Layer
End Sub
Private Sub Button1_Click(. ..)
Dim lc As new LoadCase
_layer.LoadCase s.Add(lc)
End Sub
End Class
Hope this helps a little.
Chris
Chris Dunaway wrote:
On Jun 6, 9:34 am, CoRrRan <CoRrRan~NOSPAM ~@~NOSPAM~gmail .comwrote:
>I am trying to create a class in Visual Basic 2005 environment to hold all information closely together. There are two variables I want to use, and they look like this: ************** *************** *************** *************** *********** clsLayerZ1 | +-Headers | | | +-Header1 = Text1 (String) | +-Header2 = Text2 (String) | +-.... +-LC(0) | | | +-ID = LC ID (Integer) | +-Entity(0) | | | | | +-ID = Entity ID (Integer) | | +-Loads | | | | | +-Load1 = Value1 (Double) | | +-Load2 = Value2 (Double) | | +-Load3 = Value3 (Double) | | +-.... | +-Entity(1) | | | | | +-ID = Entity ID (Integer) | | +-Loads | | | | | +-Load1 = Value1 (Double) | | +-.... | +-.... +-LC(1) | | | +-ID = LC ID (Integer) | +-.... +-.... ************** *************** *************** *************** ***********
I currently have tried to do it this way: ************** *************** *************** *************** *********** Public Class Layer
Private _iLCs As Integer Private _iHeaders As Short Private _iEntities As Long
Sub New(ByVal iLCs As Integer, ByVal iEntities As Long, ByVal iHeaders As Short) _iLCs = iLCs _iEntities = iEntities _iHeaders = iHeaders ReDim _LoadCase(_iEnt ities) End Sub
Public LoadCase(_iLCs) As LoadCase(_iEnti ties) Public Headers(_iHeade rs) As String
End Class
Public Class LoadCase
Private _iEntities As Long
Sub New(ByVal iEntities As Long) _iEntities = iEntities End Sub
Public LCID As Long Public Entities(_iEnti ties) As Entity(iLoadCom ponents)
End Class
Public Class Entity Private _iLoadComponent s As Short Sub New(ByVal iLoadComponents As Short) _iLoadComponent s = iLoadComponents End Sub Public EntityID As Long Public LoadsInfo(_iLoa dComponents) As Double
End Class ************** *************** *************** *************** ***********
Unfortunatel y, this method is not working for me. I probably have some fundamental flaws in the code I'm trying to use, but I haven't got any idea how to do this properly.
Another problem that I have: these variables are to be used in multiple procedures, but one of these procedures generates the required dimensions for the various sub-arrays in the class I want to create.
Hopefully someone is able to help me by perhaps providing me with a decent example of how this is done.
Regards, CoRrRan
Don't use arrays, instead use a List(Of LoadCase) and List(Of Entity)
respectively (If you dont have VB 2005, then use an ArrayList
instead). Then you don't have to pre-allocate the size. You can use
the .Add method to add entries to the list.
Something like this:
Public Class Layer
Sub New()
_loadCases = New List(Of LoadCase)
_headers = New List(Of String)
End Sub
Private _loadCases As List(Of LoadCase)
Public ReadOnly Property LoadCases As List(Of LoadCase)
Get
Return _loadCases
End Get
End Property
Private _headers As List(Of String)
Public ReadOnly Property Headers As List (Of String)
Get
Return _headers
End Get
End Property
End Class
You can use the class like this:
Public Class Form1 As Form
Private _layer As Layer
Public Sub New()
_layer = New Layer
End Sub
Private Sub Button1_Click(. ..)
Dim lc As new LoadCase
_layer.LoadCase s.Add(lc)
End Sub
End Class
Hope this helps a little.
Chris
Ah, that looks really promising. Thank you for your response Chris! I'll
let you know whether this results in something that's workable.
CoRrRan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kenneth |
last post by:
<list> seems to be a powerful structure to store the related nodes in
memory for fast operations, but the examples I found are all related to
primitive type storage.
I'm doing a project on C++ with my defined classes to be added to
linked list structure so as to facilitate the operation of all
instances of defined classes. Is that possible to apply such classes to
<list> or <Vector> structure?
Thanks!
|
by: Vivek Sharma |
last post by:
Hi,
I have created a dropdownlist as a web user control. I am using its
multiple instances on the webpage. How do I access the selectedValue of
each instance? All the instances have different IDs.
Thanks
Vivek
|
by: Boris |
last post by:
The .NET documentation talks about blittable and non-blittable types. While
objects of type System::Object* are non-blittable it doesn't say anything
about objects of user-defined classes. All the COM interop examples I've
seen always return objects of types of the System namespace. But what if you
want to return an object of a user-defined managed class?
public __gc class A {
public:
int i;
A(int value) : i(value) { }
|
by: paul meaney |
last post by:
All,
myself and another developer have been staring blankly at a screen for
the past 48 hours and are wondering just what stunningly obvious thing
we are missing.
We are trying to load up 2 or more user controls dynamically by adding
to a placeholder defined in page_load. I've included the sample code
for how we are accessing one. The user controls are not rocket science
- just a few text boxes with public accessor properties. We've...
|
by: Phil Certain |
last post by:
Hi,
I'm trying to do something very simple...or at least it should be. I
have created a host page (gen.aspx) and a very simple user control
(us.ascx). The corresponding code-behind files are gen.aspx.vb and
uc.ascx.vb. With simple html or self contained vb in the user control,
everything is fine and dandy. So the next stage is to pass back a
simple variable from the user control to the host page. I used VS.NEt
to create the files.
| |
by: Samuel |
last post by:
Hi,
I am building a page that makes use of user control as a templating
technique. The following is that I have in mind and it is actually working:
Root/
-- login.aspx
-- login.aspx.vb
-- UC/
----- Classic/
|
by: Hallvard B Furuseth |
last post by:
I'm wondering how to design this:
An API to let a request/response LDAP server be configured so a
user-defined Python module can handle and/or modify some or all
incoming operations, and later the outgoing responses (which are
generated by the server). Operations have some common elements,
and some which are distinct to the operation type (search, modify,
compare, etc). So do responses.
There are also some "operations" used...
|
by: The Man with no name |
last post by:
Hi,
Can we create an array of user defined dimensions in the following way:?
1 Create a class( say CONSTANT) whose lone datamember is an integer which is called say num.
2 In the public section we build a constructor function to accept user defined values.
3 We create a function to access that integer.
4 Now in this class there is no function which can alter the value of 'num'.
5 In the main we create a class of the afore mentioned...
|
by: rolan |
last post by:
I am trying to figure out how to store and access an array, which is created inside a function, and needs to be accessed outside the function.
My user defined class has set and get functions for 2 values, "value" and "pseudoAddress".
"matrix" is of the user-defined class,
"*address" is a pointer to the user-defined class
I want *address to store the value of matrix, then I want *address to increment by the size of the UD-Class.
|
by: Slaunger |
last post by:
Hi there,
I am a newcomer to Pyhton coming from Java working on a relatively
large Pyhton project with several packages and modules. To improve
exception handling I would like to introduce some user-defined
exceptions to distinguish between exceptions raised in self-written
code as compared to std libray modules used there-in.
Say, for instance I would like to define a MyParseError exception to
indicate that something has gone wrong...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |