|
Thanks for your reply.
In which cases 'ref' keyword should be used? I am confused
As your answer the following two methods will do the same thing isn't it?
1.changeItem( ref ArrayList l )
or
2.changeItem( ArrayList l )
|
|
|
|
|
Member variable "list" is a reference to the ArrayList object and not the object itself. The important thing you need to learn here is the difference between "reference types" and "value types".
All classes such as ArrayList are reference types. Class objects are created via "new" and they only exist in the heap (not the stack). "new" merely returns a reference to that new object. So, when you pass an object reference to a function, you are merely passing a copy of that reference and not a copy of that object.
All structures such as int, long, and float are value types. These types are created on the stack and are not referenced. And yes, they really are structures. int maps to the System.Int32 structure. float maps to the System.Single structure.
So, when you pass a value type into a function, you are passing a copy of its data.
I'm not sure what your goal is here, but if you want to pass a copy of your ArrayList object into your changeItem() function, then you're going to need to clone it. Cloning an object will create a new object having the same object data.
changeItem((ArrayList)list.Clone());
I hope this helps!
|
|
|
|
|
Just in case the OP misses it, only the ArrayList is cloned, not the elements in that list.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Since the ArrayList contains integers (ie: value types), it should be copied ok.
But good point to bring up. If it stored reference types, then they'll need to be cloned too.
|
|
|
|
|
Is there any way to group several radio buttons without putting them into a GroupBox ?
|
|
|
|
|
You can only have one grouping of RadioButtons per Form, GroupBox, or Panel. If you want to have several groupings that look like they're on the same form, then I suggest you put them inside borderless Panels.
|
|
|
|
|
Set the Groupnames same with the other radiobuttons
<asp:radiobutton id="RadioButton1" style="Z-INDEX: 101; LEFT: 256px; POSITION: absolute; TOP: 184px"
="" runat="server" <b="">GroupName="a">
<asp:radiobutton id="RadioButton2" style="Z-INDEX: 102; LEFT: 256px; POSITION: absolute; TOP: 224px"
="" runat="server" <b="">GroupName="a">
<asp:radiobutton id="RadioButton3" style="Z-INDEX: 103; LEFT: 440px; POSITION: absolute; TOP: 192px"
="" runat="server" <b="">GroupName="b">
<asp:radiobutton id="RadioButton4" style="Z-INDEX: 104; LEFT: 448px; POSITION: absolute; TOP: 232px"
="" runat="server" <b="">GroupName="b">
|
|
|
|
|
Hi,
Anybody have any ideas on how to best emulate a 'ReadOnly' capability for a radio button? Any help greatly appreciated.
|
|
|
|
|
Enabled = false
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I'm doing that already. Looks like sh*t.
|
|
|
|
|
Your problem statement is not clear. Can you explain it a bit more ?
|
|
|
|
|
Hi,
Thanks for your interest. I have a data application in which some boolean choices as represented by radio button pairs and at certain points in the application I am representing the data to the user in ReadOnly TextBoxes where applicable. I would like to emulate this functionality in a representation of the RadioButton and am looking for a path of least resistance to accomplish this task. Any help would be greatly appreciated.
|
|
|
|
|
Change the font color back to black after disabling the button?
|
|
|
|
|
I've taken a different approach by building my own custom control that inherits from System.Windows.Forms.RadioButton NameSpace. I'm using GDI+ to alter the presentation of the interface based off a boolean public property I've exposed called 'ReadOnly'. I'm still trying to workout how to cancel 'Click' the click event. Any help would be greatly appreciated.
|
|
|
|
|
You can stop the click Event by overriding the OnClick method in RadioButton class and Removing the call to the base class. like:
protected override void OnClick(System.EventArgs e)<br />
{<br />
}<br />
-- modified at 12:27 Monday 14th November, 2005
|
|
|
|
|
Hi, and thanks for your interest. I tried your suggestion but when I tried to build the control I received an error 'RadioButtonRocLib.RadioButtonRoc.onclick(System.EventArgs)': no suitable method found to override".
|
|
|
|
|
correct code is:
<br />
protected override void OnClick(System.EventArgs e)<br />
{<br />
}<br />
Here 'OnClick' 's 'O' and 'C' character should be in upper case. I don't know why it is not shown correctly.
|
|
|
|
|
Hi,
I have a little problem with a networkapplication i'm creating at the moment. I'm making a program where a windows service (in C#) sends information (username etc) to a java server. I have done some research allready for getting the current username in Windows:
WindowsIdentity temp = WindowsIdentity.GetCurrent().Name;
Now my problem is that i don't receive a logonname on my java server. Instead of that i get the following:
NT AUTHORITY\Lokale service
I tried some other examples (importing dll's etc) for getting the username but always gets the same reply. I really dont know how i can solve this. Does anyone has an idea what went wrong? You would help me alot...
Greetings
Steven Bruneel
|
|
|
|
|
VampireLord wrote: NT AUTHORITY\Lokale service
That is the log on name. It is a limited internal one that windows uses. Your windows service must be running in it. ASP.NET, for example, uses it on certain editions of windows.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Is there any way to get the 'real' windows login name then? Because it's that one i need to be send to my server.
I made my service in Microsoft Visual Studio .NET 2003 and installed it with the tool included in this program. The service is indeed set as 'Local' but i just don't get it why the username is "Local Service" then, it should be the name from my windows account no? *confused*
|
|
|
|
|
VampireLord wrote: Is there any way to get the 'real' windows login name then?
That is the "real" windows account name. I don't think you could login with it. What you are seeing in the Services applet is the friendly name
VampireLord wrote: The service is indeed set as 'Local' but i just don't get it why the username is "Local Service" then, it should be the name from my windows account no?
If it is "Local Service" then the real name should be NT AUTHORITY\LocalService
Find the service, right click select "properties". Go to the "Log On" tab and see what real account name it is using.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Ok, i tried something else now. In the properties of my service (called NWDUpdate) there was a property where the service signed on with the "local service"-account. I switched this to local systemaccount but i still get not the thing i want.
The thing i get now is "NT AUTHORITY\SYSTEM" as user. Isn't there any way to get just my logon name in windows then?
|
|
|
|
|
VampireLord wrote: The thing i get now is "NT AUTHORITY\SYSTEM" as user
That user is quite a dangerous one to use. It has more privileges that the Administrator account. If your service could be compromised....
VampireLord wrote: Isn't there any way to get just my logon name in windows then?
You can elect to run a service under any account you want. But, as Michael also pointed out, Windows Services are run without user interaction. Most services start up before the user even gets a chance to log on.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
Because a Windows Service can run when there is no interactive user logged on, then you have to jump through a few hoops to find the currently logged on user.
This[^] may be of some use.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I tried this now but it still gets me "SYSTEM" instead of my current name i logged on with Don't have any problems with getting computer name etc.. Just need to get my current logonname in Windows in stead of "SYSTEM".. *sigh* ;(
|
|
|
|