473,394 Members | 1,810 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,394 software developers and data experts.

class problem, How to get data from class

i'm stuck with a class problem, i want to create a class that, say for
example gets the system time, and can be displayed in label or textbox but
can be accessed many times....

ok i'll start with a pseudo example.

VB.NET
pseudo code....

public function test(variable)
do something....anything
eg get system date,time or anything
'**********************
label1.text=result 'This works here, but not in a class?
'**********************
end function

private sub form load
timer1.interval=500
timer1.enabled=true
end sub

private sub timer1_tick()
dim x as integer
test(x)
end sub

'This works fine but i want to put this in class so, it can be accessed many
times.

class myclass
'maybe withevents of inherits timer1, not sure
public function test(variable)
do something....anything

'****problem here******

label1.text=result 'this will not work but to put in its place?

'*******************
end function
private sub timer1_tick()
dim x as integer
test(x)
end sub
end class

i cant figure out how to bring the data out of the class, for example if the
data in displayed in a label, and use it to have say tens or thousands of
labels that display this data, how do i extract it from the class.
Nov 21 '05 #1
1 1008
Sympatico,

The timers (there are 3 of those which are) are alarmclocks.

For your system time is enough,
Dim dt As DateTime = Now
MessageBox.Show(dt.ToString("hh:mm"))

In my opinion is using a class for this the wrong use of OOP.

I cannot find any reason for it, in contradiction, it makes the program less
readable and process slower, although that last is in my opinion not
important for this.

I hope this helps?

Cor

"sympatico" <fe******@a1vbcode.com>
i'm stuck with a class problem, i want to create a class that, say for
example gets the system time, and can be displayed in label or textbox but
can be accessed many times....

ok i'll start with a pseudo example.

VB.NET
pseudo code....

public function test(variable)
do something....anything
eg get system date,time or anything
'**********************
label1.text=result 'This works here, but not in a class?
'**********************
end function

private sub form load
timer1.interval=500
timer1.enabled=true
end sub

private sub timer1_tick()
dim x as integer
test(x)
end sub

'This works fine but i want to put this in class so, it can be accessed
many
times.

class myclass
'maybe withevents of inherits timer1, not sure
public function test(variable)
do something....anything

'****problem here******

label1.text=result 'this will not work but to put in its place?

'*******************
end function
private sub timer1_tick()
dim x as integer
test(x)
end sub
end class

i cant figure out how to bring the data out of the class, for example if
the
data in displayed in a label, and use it to have say tens or thousands of
labels that display this data, how do i extract it from the class.

Nov 21 '05 #2

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

Similar topics

1
by: Gerry Sutton | last post by:
Hi All! I have noticed a strange behavior when using a constant identifier to initialize an instance list variable in a base class and then trying to modifying the list in subclasses by using...
7
by: Drew McCormack | last post by:
I have a C++ template class which contains a static variable whose construction registers the class with a map. Something like this: template <typename T> class M { static Registrar<M>...
0
by: Leslaw Bieniasz | last post by:
Cracow, 16.09.2004 Hi, I have a problem with compiling the following construction involving cross-calls of class template methods, with additional inheritance. I want to have three class...
7
by: jsale | last post by:
I have made an ASP.NET web application that connects to SQL Server, reading and writing data using classes. I was recommended to use session objects to store the data per user, because each user...
7
by: tshad | last post by:
I have a problem with a VS 2003 project. This project was designed and works fine in VS 2003. But trying to open the project I get the following error....
12
by: arenium | last post by:
Hi, I'll cut to the chase. I have a class named Foo(). I create an instance of this class named bar, and I set bar.data to a large list of tuples. Within Foo() there is a method which...
7
by: mathieu | last post by:
Hello, I did read the FAQ on template(*), since I could not find an answer to my current issue I am posting here. I have tried to summarize my issue in the following code (**). Basically I am...
5
by: tshad | last post by:
In VS 2003, I am setting up an abstract class that is setting up classes for each datatype of VB.Net (as well as C#). I am trying to set it up so that most of the work is done in the Abstract...
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...
4
by: sunderjs | last post by:
Hi, This is from a typical telecom software implementation. I have three subsystems (x, y, z) which exchange data amongst them. The arrangement is such that x talks to y over interface xy. y...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
0
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...
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...

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.