473,396 Members | 1,884 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.

property: can it be an object?

Can I pass a listview to another form using a property definition like this?

Public Class frmToDoDetail
Inherits System.Windows.Forms.Form

Private m_lvwTD As ListView

Public Property lvwTD() As ListView
Get
lvwTD = m_lvwTD
End Get
Set(ByVal Value As ListView)
m_lvwTD = lvwTD
End Set
End Property

.... try to access the listview using m_lvwTD or lvwTD doesn't work?
------------------------------

Here's my attempt at the 'calling' side of the code:

Dim frmTemp As New frmToDoDetail()

frmTemp.lvwTD = lvwToDo
If frmTemp.edit Then...

I do not get any syntax errors, yet the 'passed' listview object is
'nothing'. Am I on the right track?
Thanks.
Nov 20 '05 #1
3 1118

"tmaster" <le*******@travelmasterusa.com> wrote in message
news:%Y***********@fe2.columbus.rr.com...
Can I pass a listview to another form using a property definition like this?
Public Class frmToDoDetail
Inherits System.Windows.Forms.Form

Private m_lvwTD As ListView

Public Property lvwTD() As ListView
Get
lvwTD = m_lvwTD
End Get
Set(ByVal Value As ListView)
m_lvwTD = lvwTD
End Set
End Property


Your propery definition is messed up.
Should be:

Public Property lvwTD() As ListView
Get
return m_lvwTD
End Get
Set(ByVal Value As ListView)
m_lvwTD = Value
End Set
End Property

Don't use the name of the property as a local variable. It's a bad habit
from VB6, and leads to errors and confusion like you just experienced.

David

Nov 20 '05 #2
Thanks. Your suggestion worked fine.

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:OC****************@TK2MSFTNGP12.phx.gbl...

"tmaster" <le*******@travelmasterusa.com> wrote in message
news:%Y***********@fe2.columbus.rr.com...
Can I pass a listview to another form using a property definition like

this?

Public Class frmToDoDetail
Inherits System.Windows.Forms.Form

Private m_lvwTD As ListView

Public Property lvwTD() As ListView
Get
lvwTD = m_lvwTD
End Get
Set(ByVal Value As ListView)
m_lvwTD = lvwTD
End Set
End Property


Your propery definition is messed up.
Should be:

Public Property lvwTD() As ListView
Get
return m_lvwTD
End Get
Set(ByVal Value As ListView)
m_lvwTD = Value
End Set
End Property

Don't use the name of the property as a local variable. It's a bad habit
from VB6, and leads to errors and confusion like you just experienced.

David

Nov 20 '05 #3
* "tmaster" <le*******@travelmasterusa.com> scripsit:
Can I pass a listview to another form using a property definition like this?

Public Class frmToDoDetail
Inherits System.Windows.Forms.Form

Private m_lvwTD As ListView

Public Property lvwTD() As ListView
Get
lvwTD = m_lvwTD
Replace the line above with 'Return m_lvwTD'.
End Get
Set(ByVal Value As ListView)
m_lvwTD = lvwTD
End Set
End Property

... try to access the listview using m_lvwTD or lvwTD doesn't work?


--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

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

Similar topics

2
by: Aaron | last post by:
Hi, I've seen javascript code where a constructor function is passed an argument "document", and inside the function itself the assignment "this.document = document;" is made. This is the code...
16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
3
by: MattC | last post by:
Hi, I found this code somewhere on the net and need to make some alterations. public class GenericSorter : IComparer { String sortProperty; bool sortOrder; public GenericSorter(String...
2
by: Hal Heinrich | last post by:
I have the following class: Public Class myObj Dim x as myOtherObj Public Property otherObject() As myOtherObj Get otherObject = x End Get
10
by: dgk | last post by:
I'm searching for a way to determine if control values have changed. For some it's easy, such as TextBox.Modified. But looking at the radiobutton I come across IsMirrored. Curious, I look to the...
3
by: Mark Jones | last post by:
I am quite new to ASP and .Net development and I am building a web-based multiple choice exam application. The web page displays the questions using a Repeater control and the answers are nested...
15
by: Sam Kong | last post by:
Hello! I got recently intrigued with JavaScript's prototype-based object-orientation. However, I still don't understand the mechanism clearly. What's the difference between the following...
0
by: Memfis | last post by:
While I was looking through the group's archives I came across a discussion on doing properties (as known from Delphi/C#/etc) in C++. It inspired me to do some experimenting. Here's what I came up...
2
by: =?Utf-8?B?Z2FkeWE=?= | last post by:
I use one of 2 arrays dependent on the country. Rather than say: if exchangeID = 1 then dim myPlaceBets() as As UK.exchange.PlaceBets many statements myPlaceBetsReq.bets = myPlaceBets else...
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
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...
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
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:
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
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
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.