473,396 Members | 2,158 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,396 software developers and data experts.

variable declaration ?

rJ
hi,

what does the following statement mean and what does it do?

Dim obTest As Record.Class1 =
CType(Class2.GetSessionInfo(class3.TestConstant), Record.Class1)

GetSessionInfo() simply does this Return Me.Session(name)

TestConstant is a contstant containing "test.tester"

What does me.session(name) do?

Also, since class1 has many methods, about 10 properties, and 2 collections
does this assign structure of properties to obTest?

Thanks a lot.

Jun 22 '06 #1
6 1239
Hi,

Thank you for posting.

It's hard for me to explain the statement at this point. Would you please
show me the whole related code including the definition of Class1, Class2
and Class3?

I look forward to your reply.

Sincerely,
Linda Liu
Microsoft Online Community Support

================================================== ==
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ==

Jun 23 '06 #2
Hello RJ,

Simple... Let's break it down.

Dim obTest As Record.Class1 ' This creates a variable named obTest with
a data type of Record.Class1
the = sign in a Dim statement means that the right side of the expression
will be used to initialize the variable

CType converts parameter1 into a variable of datatype parameter2... So:
Class2.GetSessionInfo(class3.TestConstant) gets converted into a Record.Class1..
which then gets assigned to obTest.

Simple eh.

-Boo
hi,

what does the following statement mean and what does it do?

Dim obTest As Record.Class1 =
CType(Class2.GetSessionInfo(class3.TestConstant), Record.Class1)

GetSessionInfo() simply does this Return Me.Session(name)

TestConstant is a contstant containing "test.tester"

What does me.session(name) do?

Also, since class1 has many methods, about 10 properties, and 2
collections does this assign structure of properties to obTest?

Thanks a lot.

Jun 23 '06 #3
RJ,

See inline

Dim obTest As Record.Class1 =
CType(Class2.GetSessionInfo(class3.TestConstant), Record.Class1)
This means that you create an Object obTest, that holds the reference to the
object Class2.GetSessionInfo(class3.TestConstant).

You can use that obTest object now direct without everytime to use that long
description.
(The word DirectCast instead of CType (convert type) would here probably be
better)

GetSessionInfo() simply does this Return Me.Session(name)
I don't see this on MSDN, which means that it is a method in your program
(class)
TestConstant is a contstant containing "test.tester"

What does me.session(name) do?

A session is a temporaly storage used to holds data between send and
postback from webpages.
Also, since class1 has many methods, about 10 properties, and 2
collections does this assign structure of properties to obTest?

The difference between a Class and a structure is the place where it is in
memory. A structure is always direct in your mainprogram on the main heap an
therefore inefficient. A class is on the managed heap, and can be destroyed
(is automaticly done by the managed code) when not needed anymore/

Therefore if something is in a class, than it is in the class and not in a
structure. (Although a class can reference to a structure).

I hope this helps,

Cor
Jun 23 '06 #4
typing error,

Main heap has to be Main stack, my thought was already something further in
the message.

Cor

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:%2****************@TK2MSFTNGP03.phx.gbl...
RJ,

See inline

Dim obTest As Record.Class1 =
CType(Class2.GetSessionInfo(class3.TestConstant), Record.Class1)


This means that you create an Object obTest, that holds the reference to
the object Class2.GetSessionInfo(class3.TestConstant).

You can use that obTest object now direct without everytime to use that
long description.
(The word DirectCast instead of CType (convert type) would here probably
be better)

GetSessionInfo() simply does this Return Me.Session(name)

I don't see this on MSDN, which means that it is a method in your program
(class)
TestConstant is a contstant containing "test.tester"

What does me.session(name) do?


A session is a temporaly storage used to holds data between send and
postback from webpages.
Also, since class1 has many methods, about 10 properties, and 2
collections does this assign structure of properties to obTest?

The difference between a Class and a structure is the place where it is in
memory. A structure is always direct in your mainprogram on the main heap
an therefore inefficient. A class is on the managed heap, and can be
destroyed (is automaticly done by the managed code) when not needed
anymore/

Therefore if something is in a class, than it is in the class and not in a
structure. (Although a class can reference to a structure).

I hope this helps,

Cor

Jun 23 '06 #5
rJ
First of all...thank you all for your responses. It is greatly appreciated.
GetSessionInfo() simply does this Return Me.Session(name)

I don't see this on MSDN, which means that it is a method in your program
(class)

It is a method in my code that contains only
Return Me.Session(name)

The value of class3.TestConstant is "test.tester" at run time according to
debug. I see where the constant is assigned in class3. So at run time
Class2.GetSessionInfo(class3.TestConstant) is equal to "test.tester" so
statement would then be
CType("test.tester", Record.Class1).

How is "test.test" being returned as Record.Class1?

I just don't get what CType(Class2.GetSessionInfo(class3.TestConstant),
Record.Class1) is doing and why you would want to do this? :(

Why not just stop at
Dim obTest As Record.Class1

Why is the initial value being set to
CType(Class2.GetSessionInfo(class3.TestConstant), Record.Class1)

Finally, why don't we have to have New keyword behind as in variable
declaration? I have searched entire project and don't find a Dim obTest as
New Record.Class1.

Thanks again for your patience and assistance.

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl... RJ,

See inline

Dim obTest As Record.Class1 =
CType(Class2.GetSessionInfo(class3.TestConstant), Record.Class1)


This means that you create an Object obTest, that holds the reference to
the object Class2.GetSessionInfo(class3.TestConstant).

You can use that obTest object now direct without everytime to use that
long description.
(The word DirectCast instead of CType (convert type) would here probably
be better)

GetSessionInfo() simply does this Return Me.Session(name)

I don't see this on MSDN, which means that it is a method in your program
(class)
TestConstant is a contstant containing "test.tester"

What does me.session(name) do?


A session is a temporaly storage used to holds data between send and
postback from webpages.
Also, since class1 has many methods, about 10 properties, and 2
collections does this assign structure of properties to obTest?

The difference between a Class and a structure is the place where it is in
memory. A structure is always direct in your mainprogram on the main heap
an therefore inefficient. A class is on the managed heap, and can be
destroyed (is automaticly done by the managed code) when not needed
anymore/

Therefore if something is in a class, than it is in the class and not in a
structure. (Although a class can reference to a structure).

I hope this helps,

Cor

Jun 23 '06 #6
Hi Rj,

Thank you for your update.

It seems that the expression "Class2.GetSessionInfo(class3.TestContant)"
returns a object of type Record.Class1. You can assign this returned object
to the variable obTest and needn't use New keyword.

Although the value of class3.TestConstant is "test.tester" at run time,
Class2.GetSessionInfo(class3.TestConstant) should not be equal to
"test.tester". It should be equal to the value of the expression of
"Me.Session(name)".

I think the core of the problem is the expression "Me.Session(name)", which
is not clear to us until now. In order to explain this expression, would
you please show us the entire related code?

I look forward to your reply.

Sincerely,
Linda Liu
Microsoft Online Community Support

================================================== ==
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ==

Jun 26 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
7
by: YGeek | last post by:
Is there any difference between declaring a variable at the top of a method versus in the code of the method? Is there a performance impact for either choice? What about if the method will return...
2
by: Thomas Matthews | last post by:
Hi, I'm getting linking errors when I declare a variable in the global scope, but not inside a function. The declarations are the same (only the names have been changed...). class Book {...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
4
by: Ray | last post by:
Hello, I think I've had JavaScript variable scope figured out, can you please see if I've got it correctly? * Variables can be local or global * When a variable is declared outside any...
14
by: subramanian100in | last post by:
Consider the following program: #include <iostream> using namespace std; int main() { int i;
2
by: Shraddha | last post by:
Can we declare extern variable as static? What will be the scope of the variable then? What if we change the value of the variable in some other function? Also can someone tell me that if we can...
1
NeoPa
by: NeoPa | last post by:
Problem Description : In VBA there is an option to enforce declaration of variables in your code. With this set, any reference to a variable that has not been previously declared (Dim; Private;...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
11
by: whirlwindkevin | last post by:
I saw a program source code in which a variable is defined in a header file and that header file is included in 2 different C files.When i compile and link the files no error is being thrown.How is...
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...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.