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

How do I make this work?

Ron
I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function

I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and then
twoes

I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and word2,
but they would actually have the values smoke and alarm in them/?

How do I do something like this?

Feb 15 '07 #1
7 1196
Homework?

"Ron" <pt*****@yahoo.comschreef in bericht
news:11**********************@p10g2000cwp.googlegr oups.com...
>I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function

I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and then
twoes

I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and word2,
but they would actually have the values smoke and alarm in them/?

How do I do something like this?

Feb 15 '07 #2
Ron
Yes sort of although not for a grade just to learn classes, i just
dont know where to start with this.
On Feb 15, 3:51 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Homework?

"Ron" <pts4...@yahoo.comschreef in berichtnews:11**********************@p10g2000cwp.g ooglegroups.com...
I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function
I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and then
twoes
I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and word2,
but they would actually have the values smoke and alarm in them/?
How do I do something like this?- Hide quoted text -

- Show quoted text -

Feb 15 '07 #3
You need to instantiate your new class, and you can use your constructor
that takes both arguments; then you can access the properties [first] and
[second] for that object.

ones = new WordPair("smoke", "alarm")
debug.print(ones.first) --smoke
debug.print(ones.second) --alarm

Robin S.
-------------------------------
"Ron" <pt*****@yahoo.comwrote in message
news:11*********************@s48g2000cws.googlegro ups.com...
Yes sort of although not for a grade just to learn classes, i just
dont know where to start with this.
On Feb 15, 3:51 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
>Homework?

"Ron" <pts4...@yahoo.comschreef in
berichtnews:11**********************@p10g2000cwp. googlegroups.com...
>I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function
I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and then
twoes
I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and word2,
but they would actually have the values smoke and alarm in them/?
How do I do something like this?- Hide quoted text -

- Show quoted text -


Feb 16 '07 #4
Ron
Here is what I did, I created a new module and did this:
Module word
Dim ones As New WordPair
Dim twos As New WordPair
wordpair.ones = ("","")
wordpair.twos=("smoke","alarm")

End Module

What it is doing now is underlining in blue WORDPAIR and says
decleration expected ?
On Feb 15, 7:00 pm, "RobinS" <Rob...@NoSpam.yah.nonewrote:
You need to instantiate your new class, and you can use your constructor
that takes both arguments; then you can access the properties [first] and
[second] for that object.

ones = new WordPair("smoke", "alarm")
debug.print(ones.first) --smoke
debug.print(ones.second) --alarm

Robin S.
-------------------------------"Ron" <pts4...@yahoo.comwrote in message

news:11*********************@s48g2000cws.googlegro ups.com...
Yes sort of although not for a grade just to learn classes, i just
dont know where to start with this.
On Feb 15, 3:51 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Homework?
"Ron" <pts4...@yahoo.comschreef in
berichtnews:11**********************@p10g2000cwp.g ooglegroups.com...
I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function
I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and then
twoes
I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and word2,
but they would actually have the values smoke and alarm in them/?
How do I do something like this?- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

Feb 16 '07 #5
You have to tell it what you're defining them as before "new-ing" them.

Dim ones as WordPair = New WordPair()
Dim twos as WordPair = New WordPair()

Robin S.
--------------------------

"Ron" <pt*****@yahoo.comwrote in message
news:11********************@a75g2000cwd.googlegrou ps.com...
Here is what I did, I created a new module and did this:
Module word
Dim ones As New WordPair
Dim twos As New WordPair
wordpair.ones = ("","")
wordpair.twos=("smoke","alarm")

End Module

What it is doing now is underlining in blue WORDPAIR and says
decleration expected ?
On Feb 15, 7:00 pm, "RobinS" <Rob...@NoSpam.yah.nonewrote:
>You need to instantiate your new class, and you can use your constructor
that takes both arguments; then you can access the properties [first]
and
[second] for that object.

ones = new WordPair("smoke", "alarm")
debug.print(ones.first) --smoke
debug.print(ones.second) --alarm

Robin S.
-------------------------------"Ron" <pts4...@yahoo.comwrote in
message

news:11*********************@s48g2000cws.googlegr oups.com...
Yes sort of although not for a grade just to learn classes, i just
dont know where to start with this.
On Feb 15, 3:51 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Homework?
>"Ron" <pts4...@yahoo.comschreef in
berichtnews:11**********************@p10g2000cwp. googlegroups.com...
>I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function
I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and then
twoes
I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and
word2,
but they would actually have the values smoke and alarm in them/?
How do I do something like this?- Hide quoted text -
>- Show quoted text -- Hide quoted text -

- Show quoted text -


Feb 16 '07 #6
Ron
OK thanks that makes sense.
So what if I want to display Smoke and Alarm, those values in a label
do I just:
labelword.text = "1st word =" & word1 & "2nd word =" & word2 ?
On Feb 15, 10:35 pm, "RobinS" <Rob...@NoSpam.yah.nonewrote:
You have to tell it what you're defining them as before "new-ing" them.

Dim ones as WordPair = New WordPair()
Dim twos as WordPair = New WordPair()

Robin S.
--------------------------

"Ron" <pts4...@yahoo.comwrote in message

news:11********************@a75g2000cwd.googlegrou ps.com...
Here is what I did, I created a new module and did this:
Module word
Dim ones As New WordPair
Dim twos As New WordPair
wordpair.ones = ("","")
wordpair.twos=("smoke","alarm")
End Module
What it is doing now is underlining in blue WORDPAIR and says
decleration expected ?
On Feb 15, 7:00 pm, "RobinS" <Rob...@NoSpam.yah.nonewrote:
You need to instantiate your new class, and you can use your constructor
that takes both arguments; then you can access the properties [first]
and
[second] for that object.
ones = new WordPair("smoke", "alarm")
debug.print(ones.first) --smoke
debug.print(ones.second) --alarm
Robin S.
-------------------------------"Ron" <pts4...@yahoo.comwrote in
message
>news:11*********************@s48g2000cws.googlegr oups.com...
Yes sort of although not for a grade just to learn classes, i just
dont know where to start with this.
On Feb 15, 3:51 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Homework?
"Ron" <pts4...@yahoo.comschreef in
berichtnews:11**********************@p10g2000cwp.g ooglegroups.com...
I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function
I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and then
twoes
I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and
word2,
but they would actually have the values smoke and alarm in them/?
How do I do something like this?- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

Feb 16 '07 #7
No, word1 and word2 are private within the class. Go back down and look at
my example that prints out the results.

Robin S.
-----------------------------------
"Ron" <pt*****@yahoo.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
OK thanks that makes sense.
So what if I want to display Smoke and Alarm, those values in a label
do I just:
labelword.text = "1st word =" & word1 & "2nd word =" & word2 ?
On Feb 15, 10:35 pm, "RobinS" <Rob...@NoSpam.yah.nonewrote:
>You have to tell it what you're defining them as before "new-ing" them.

Dim ones as WordPair = New WordPair()
Dim twos as WordPair = New WordPair()

Robin S.
--------------------------

"Ron" <pts4...@yahoo.comwrote in message

news:11********************@a75g2000cwd.googlegro ups.com...
Here is what I did, I created a new module and did this:
Module word
Dim ones As New WordPair
Dim twos As New WordPair
wordpair.ones = ("","")
wordpair.twos=("smoke","alarm")
End Module
What it is doing now is underlining in blue WORDPAIR and says
decleration expected ?
On Feb 15, 7:00 pm, "RobinS" <Rob...@NoSpam.yah.nonewrote:
You need to instantiate your new class, and you can use your
constructor
that takes both arguments; then you can access the properties [first]
and
[second] for that object.
> ones = new WordPair("smoke", "alarm")
debug.print(ones.first) --smoke
debug.print(ones.second) --alarm
>Robin S.
-------------------------------"Ron" <pts4...@yahoo.comwrote in
message
>>news:11*********************@s48g2000cws.googleg roups.com...
Yes sort of although not for a grade just to learn classes, i just
dont know where to start with this.
On Feb 15, 3:51 pm, "Cor Ligthert [MVP]" <notmyfirstn...@planet.nl>
wrote:
Homework?
>"Ron" <pts4...@yahoo.comschreef in
berichtnews:11**********************@p10g2000cwp. googlegroups.com...
>I have a couple of questions about this class.....:
Public Class WordPair
Private word1 As String
Private word2 As String
Public Sub New()
word1 = ""
word2 = ""
End Sub
Public Sub New(ByVal w1 As String, ByVal w2 As String)
word1 = w1
word2 = w2
End Sub
Public Property first() As String
Get
Return word1
End Get
Set(ByVal w1 As String)
word1 = w1
End Set
End Property
Public Property second() As String
Get
Return word2
End Get
Set(ByVal w2 As String)
word2 = w2
End Set
End Property
Public Function isFull() As Boolean
'Determines if a WordPair object contains both words
End Function
I then have a form that has a button, display, a testbox and a
label. I want to give the class an object called ones and
then
twoes
I then want to fill ones word1 with smoke and word2 with alarm
After the pressing the button the label would display word1 and
word2,
but they would actually have the values smoke and alarm in
them/?
How do I do something like this?- Hide quoted text -
>- Show quoted text -- Hide quoted text -
>- Show quoted text -- Hide quoted text -

- Show quoted text -


Feb 16 '07 #8

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

Similar topics

2
by: Venkat | last post by:
Hi, My HTML page doesnot work properly in Netscape 7.1. But works fine in Opera 7 and IE 6.0. I could not figure out the problem. If any one could/suggest it would be nice.. This piece of HTML...
2
by: Andrew Mogford | last post by:
Hi, We have moved a web site from a development server running Windows 2000 and IIS 5 to a Windows 2003 server running IIS 6.0 Now the asp pages do not work correctly. For example,...
0
by: Jarod_24 | last post by:
How does tabindex work in ASP .net pages I dosen't seem to work quite like in regular forms. and there isn't any TabStop property either. 1 .How do you prevent a control form beign "tabbed"....
30
by: bblais | last post by:
Hello, Let me start by saying that I am coming from a background using Matlab (or Octave), and C++. I am going to outline the basic nuts-and-bolts of how I work in these languages, and ask for...
4
by: rodchar | last post by:
hey all, i working with the Publisher object model in an ASP.NET page. When I'm working with my project locally everything works fine. However, when I deploy the application to my app server, it...
9
by: Cliff | last post by:
I've got a number of SNMP devices scattered around the globe that I want to get some information off.. I've got a couple of classes whcih get a quite complex table together from SQL and SNMP...
3
by: hscott93 | last post by:
Hello. I have a new Vista based laptop at work that connects to a Windows 2003 Small Business Server at work via an assigned, static IP address. When I take the laptop home, I have router that...
2
by: gsherp | last post by:
I can get the Onclick event handler to work when I added a new row using insertRow. It doesn't work in IE or in FF var cellarea = row.insertCell(2); cellarea.style.backgroundColor =...
0
by: wimdows | last post by:
Hi, I've successfully added custom fields to the Task Work Item template, using the Process Editor (and opening from server). However, I would like to also see these items in the field list...
1
by: FlashT | last post by:
Hello, I got a script: http://www.mattkruse.com/javascript/autocomplete/index.html It works fine on IE and Opera, but does not on FF. It does something on FF, but not what it should do (check...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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
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.