Objects are by value when passing them without specifying, you would need to
specify (ref) otherwise.
When you do me.myotherLink = hlnk both refer to the same object they are
still however independent objects themselves. Changing the value of the
first will not change the value of second even though their values are still
references to the same object, changes made to the object through the first
object will be visible through the second object.
I hope I didnt' make this more confusing...
Regards,
Brian
"Yankee Imperialist Dog" <>
wrote in message news:5CBEF6CF-8949-47C3-982B-...
> Thanks for responsing,
> That is exactly what i have done except not with a loop (yet). I'm
> starting
> create a "bag" of functions (or Subs) for situations like this.
> 1. I thouht that objects were by value not by reference in dot.net?
> 2. in the loop would the id be overwritten as it is an attribute?
>
> Still new to this so hope my question makes sense....
> --
> Share The Knowledge. I need all the help I can get and so do you!
>
>
> "Brian Williams" wrote:
>
>> When you do me.myotherLink = klink they both point to the same object in
>> memory essentially they are the same object.
>> What I would do is create a clone method adding all the properties and
>> attributes.
>>
>> I don't know VB.Net so my example will be in C#.
>>
>> HyperLink hlnk = this.gvSSShot.SelectedRow.FindControl("hlnk_BPChar t");
>> HyperLink hl = Clone(hlnk);
>> hl.ID = "NewControlID";
>> PlaceHolder1.Controls.Add(hl);
>>
>> private static HyperLink Clone(HyperLink ctrl)
>> {
>> HyperLink hl = new HyperLink();
>> hl.Text = ctrl.Text;
>> hl.ImageUrl = ctrl.ImageUrl;
>> hl.NavigateUrl = ctrl.NavigateUrl;
>>
>> foreach (string attribute in ctrl.Attributes.Keys)
>> {
>> hl.Attributes[attribute] = ctrl.Attributes[attribute];
>> }
>> return hl;
>> }
>>
>> I hope this helps, maybe someone will have a better solution.
>>
>> Regards,
>> Brian K. Williams
>>
>> "Yankee Imperialist Dog" <>
>> wrote in message
>> news:0CEB1567-3AA4-4E29-9A3B-...
>> > why does this not work: I'm trying to resign the values from one
>> > Hyperlink
>> > to
>> > another hyperlink
>> > Dim hlnk As HyperLink =
>> > Me.gvSSShot.SelectedRow.FindControl("hlnk_BPChart" )
>> > ' then just give it everything from the found link
>> > me.myotherLink = hlnk
>> >
>> > It seems to me this should work and negate the need to assign text,
>> > NavagateURL, target, ....
>> >
>> > Anyone know why?
>> > Thanks
>> > --
>> > Share The Knowledge. I need all the help I can get and so do you!
>>
>>
>>