|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Copying A Control Not As A ReferenceI have a Control that I want to copy as a copy of the Control, not a copy of
the reference to the original. My reason for doing this is because some of the methods I would calling would prevent proper rendering afterwards. I access the Control as a parameter of a function, as follows: Private Function MyFunction(ByVal ctrl As Control) As String 'code that will make a copy of ctrl 'my function code End Function (NOTE: I am using VB.NET and .NET Framework 1.1) Thanks. Nathan Sokalski wrote:
>I have a Control that I want to copy as a copy of the Control, not a copy of You have to pass the ctrl ByRef in order to be working with the one you >the reference to the original. My reason for doing this is because some of >the methods I would calling would prevent proper rendering afterwards. I >access the Control as a parameter of a function, as follows: > >Private Function MyFunction(ByVal ctrl As Control) As String > 'code that will make a copy of ctrl > 'my function code >End Function > >(NOTE: I am using VB.NET and .NET Framework 1.1) Thanks. > > want to copy. T That does not help. Let me try explaining my problem differently with an
example: Private Function MyFunction(ByVal ctrl As Control) As String dim copyofctrl as Control 'copyofctrl=ctrl this will be replaced with code that will assign a copy of ctrl to copyofctrl that points to a new instance of whatever type ctrl was 'my function code End Function In the part of my code labeled "my function code" I want to be able to do ANYTHING I WANT to the local variable copyofctrl without having any effect on ctrl. Hopefully this clears up what I am trying to do. Show quoteHide quote "tomb" <t***@technetcenter.com> wrote in message news:RV5jg.71053$QU3.68250@bignews8.bellsouth.net... > Nathan Sokalski wrote: > >>I have a Control that I want to copy as a copy of the Control, not a copy >>of the reference to the original. My reason for doing this is because some >>of the methods I would calling would prevent proper rendering afterwards. >>I access the Control as a parameter of a function, as follows: >> >>Private Function MyFunction(ByVal ctrl As Control) As String >> 'code that will make a copy of ctrl >> 'my function code >>End Function >> >>(NOTE: I am using VB.NET and .NET Framework 1.1) Thanks. >> > You have to pass the ctrl ByRef in order to be working with the one you > want to copy. > > T
Show quote
Hide quote
"tomb" <t***@technetcenter.com> schrieb: No, you should pass it 'ByVal' because 'Control' is already a reference >>I have a Control that I want to copy as a copy of the Control, not a copy >>of the reference to the original. My reason for doing this is because some >>of the methods I would calling would prevent proper rendering afterwards. >>I access the Control as a parameter of a function, as follows: >> >>Private Function MyFunction(ByVal ctrl As Control) As String >> 'code that will make a copy of ctrl >> 'my function code >>End Function >> >>(NOTE: I am using VB.NET and .NET Framework 1.1) Thanks. > > You have to pass the ctrl ByRef in order to be working with the one you > want to copy. type. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Nathan,
If a class is serializable you can almost forever copy something to serialize the object first and than deserialize it again. http://www.vb-tips.com/default.aspx?ID=7ffd296f-9e81-47e6-88dc-61641f5c8d9d I hope this helps, Cor Show quoteHide quote "Nathan Sokalski" <njsokal***@hotmail.com> schreef in bericht news:%23ZajLSdjGHA.3440@TK2MSFTNGP02.phx.gbl... >I have a Control that I want to copy as a copy of the Control, not a copy >of the reference to the original. My reason for doing this is because some >of the methods I would calling would prevent proper rendering afterwards. I >access the Control as a parameter of a function, as follows: > > Private Function MyFunction(ByVal ctrl As Control) As String > 'code that will make a copy of ctrl > 'my function code > End Function > > (NOTE: I am using VB.NET and .NET Framework 1.1) Thanks. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ >
richtextbox changing fontstyles for selected text
is it possible to get delegates from properties directly? line breaks control types "Global" objects Parsing the appended data of log file in real time XML-RPC richtextbox selectedtext bold upper .... how to find out Tabindex is driving me nuts!!! actions done twice but only one trigger? |
|||||||||||||||||||||||