Click here to Skip to main content
15,891,409 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow do I save to file? Pin
MrGee30-Jul-03 4:32
MrGee30-Jul-03 4:32 
AnswerRe: How do I save to file? Pin
Martin Cross30-Jul-03 4:44
Martin Cross30-Jul-03 4:44 
GeneralRe: How do I save to file? Pin
MrGee30-Jul-03 5:54
MrGee30-Jul-03 5:54 
GeneralRe: How do I save to file? Pin
Martin Cross30-Jul-03 6:02
Martin Cross30-Jul-03 6:02 
GeneralRe: How do I save to file? Pin
phlipping31-Jul-03 23:30
phlipping31-Jul-03 23:30 
GeneralRe: How do I save to file? Pin
MrGee1-Aug-03 8:04
MrGee1-Aug-03 8:04 
QuestionImplementing Pointers in VB.NET? Pin
Martin Cross29-Jul-03 23:59
Martin Cross29-Jul-03 23:59 
AnswerRe: Implementing Pointers in VB.NET? Pin
Mike Dimmick30-Jul-03 5:13
Mike Dimmick30-Jul-03 5:13 
TextBox and Object are reference types. You should pass a reference type ByVal unless you need to change what the reference points to inside the called function. I can't think of a reason offhand.

If you want to keep referring to the same object within your collection, you shouldn't use Clone. That's for making a copy of the remote object.

This kind of thing is best dealt with using diagrams, unfortunately. I'll try with words.

Say you call Bind like so:
Bind( TextBox1, m_oData1 )
TextBox1 isn't actually the text box itself: it's just a reference to the text box. If, inside Sub Bind, you had the statement:
ptrControl = TextBox2
the field TextBox1 would now refer to the same control as TextBox2.

In your code, when you use
ptrElement.ptrMember = ptrMember.Clone()
that makes a new object which is a copy of the object referred to by ptrMember, then sets ptrElement.ptrMember to point to the new object. There's no link between this object and the original ptrMember.

I think your implementation will work if it looks more like:
Public Sub Bind( ByVal ptrControl as System.Windows.Forms.TextBox, ByVal ptrMember as Object )
 
   AddHandler ptrControl.KeyPress, AddressOf ConsumeKeyPress

   Dim ptrElement As New ControlCollectionGroup()
  
   ptrElement.ptrControl = ptrControl
   ptrElement.ptrMember = ptrMember

   colControls.Add( ptrElement )
 
End Sub
Hope this helps.

Personally I find reference languages to be more, not less, confusing than languages with explicit pointers. I can follow explicit pointers because it's obvious - to me - what's happening.
GeneralRe: Implementing Pointers in VB.NET? Pin
Martin Cross30-Jul-03 5:29
Martin Cross30-Jul-03 5:29 
GeneralSpeech recognition Pin
S.Seetharaman29-Jul-03 22:32
S.Seetharaman29-Jul-03 22:32 
GeneralRe: Speech recognition Pin
Anonymous30-Jul-03 12:02
Anonymous30-Jul-03 12:02 
GeneralC# -> VB.NET port request Pin
Joey Lott29-Jul-03 9:59
sussJoey Lott29-Jul-03 9:59 
GeneralRe: C# -> VB.NET port request Pin
Bo Hunter29-Jul-03 10:39
Bo Hunter29-Jul-03 10:39 
GeneralRe: C# -> VB.NET port request Pin
wadester3-Aug-03 15:14
wadester3-Aug-03 15:14 
QuestionHow to import Data from MPP Pin
Samya28-Jul-03 22:47
Samya28-Jul-03 22:47 
AnswerRe: How to import Data from MPP Pin
Anonymous31-Jul-03 21:09
Anonymous31-Jul-03 21:09 
GeneralShowing Form Pin
THEMYTH28-Jul-03 21:55
THEMYTH28-Jul-03 21:55 
GeneralRe: Showing Form Pin
Nic Rowan28-Jul-03 23:47
Nic Rowan28-Jul-03 23:47 
QuestionHowTo: 2's Complement sum checksum? Pin
DudleyDoorite28-Jul-03 16:15
DudleyDoorite28-Jul-03 16:15 
AnswerRe: HowTo: 2's Complement sum checksum? Pin
pxw16-Aug-03 7:01
pxw16-Aug-03 7:01 
AnswerRe: HowTo: 2's Complement sum checksum? Pin
pxw16-Aug-03 10:23
pxw16-Aug-03 10:23 
GeneralSetup Interrupted; Requires the .NET Framework Pin
Jm6k28-Jul-03 8:46
Jm6k28-Jul-03 8:46 
GeneralRe: Setup Interrupted; Requires the .NET Framework Pin
Nic Rowan28-Jul-03 23:58
Nic Rowan28-Jul-03 23:58 
GeneralRe: Setup Interrupted; Requires the .NET Framework Pin
Richard Day1-Aug-03 2:47
Richard Day1-Aug-03 2:47 
GeneralOutlook VBA question Pin
NickOne28-Jul-03 7:53
NickOne28-Jul-03 7:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.