|
Perfect ! That seems to be a good solution.
This static method returns a readonly copy of the ArrayList. Moreover if the original list is modified (directly or through a binding process), then the readonly copy is updated (synchronized). Very well !
Thanks very much.
- Éric -
|
|
|
|
|
|
|
Finally I'm going to use the following method :
public class MyClass
{
ArrayList _AL = new ArrayList();
public IList MyList
{
get { return ArrayList.ReadOnly(_AL); }
}
...
}
- Éric -
|
|
|
|
|
I think there's not much you can do. If you're trying to achieve the same effect as const in C++, the news is that in C++ you can just as easily cast away constness and have the same issue.
Here's my viewpoint:
You as the programmer are doing all you can to make your collection readonly. If someone wants to modify it badly enough, they'll have to take the extra step of casting it and in doing so they assume the responsibility of what problems that may cause.
In other words, it's not your problem. There's only so much you can do and spending time worrying about what some hacker may do is not worth it, IMHO.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Having said all that, I just found a ReadOnly method in ArrayList that gives you the extra safety you need.
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Perfect ! That seems to be a good solution.
This static method returns a readonly copy of the ArrayList. Moreover if the original list is modified (directly or through a binding process), then the readonly copy is updated (synchronized). Very well !
Thanks very much.
|
|
|
|
|
I insert an object(object is writed as winform user control whin c#) in a webform
I want to pass some param to the object
I define the object like this
<object id="AnimTool" height="1024" width="768"
classid="/Web_1/AnimInkControl.dll#SketchBoard.Web.Animation.AnimInkControl"
="" viewastext=""> <param name="Path" />
now I want to pass the param to the object with the user selected path
because the param value is depends on the user selection
so How can I pass the Param to the object?
I used js like this
AnimTool.Path = " df"
but when I open it ,it reports js cann't found the AnimTool object
AnimTool is not define.
why,how?
|
|
|
|
|
Hi!
I have a smart phone device based on GSM/GPRS. I used the VS extension ...Smart Devices Extension to
build an application (the GUI and all) for the phone. But now I need to talk to another device which is also GPRS based.
I want a minimal functionality of passing strings from my device to the other.
How do I do this? Could you tell me where I can find information on this topic?
Zippy
|
|
|
|
|
i want to provide help in my project..how can i create help? is there any component available..?
-bhavin
|
|
|
|
|
Search for "Help Provider component" in msdn for more information.
You need to use the HelpProvider class.
To create help you can use tools like robohelp or the html help toolkit or vs help integeration kit[^]
- Kannan
|
|
|
|
|
i'm having a problem when i check some items in a listview. i have a textbox and a listview and when i check the items in the listview it updates the text in the textbox. my problem is when i check the items my event is always one step behind. example, i check 'a' and nothing happens, i check 'b' and the textbox show 'a', i check 'c' and the textbox shows 'a, b'. what event do i put my code into or is there a trick to this.
thanks,
Rob
my event:
private void lvNameDisplay_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)<br />
{<br />
System.Text.StringBuilder newText = new System.Text.StringBuilder();<br />
foreach (ListViewItem lvItem in lvNameDisplay.CheckedItems)<br />
{<br />
newText.Append(lvItem.Text + ", ");<br />
}<br />
tbExample.Text = newText.ToString();<br />
if (tbExample.Text.EndsWith(", "))<br />
{<br />
tbExample.Text = tbExample.Text.Substring(0, tbExample.Text.Length-2);<br />
}<br />
}
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Try writing ur code in the handler for SelectedValueChanged event.
The ItemCheck event is triggered just BEFORE an item is about to be checked...and the value is updated only AFTER this event completes...that explains the "lag" u xperienced!
private void listview_SelectedValueChanged(object sender, System.EventArgs e)
{
System.Text.StringBuilder newText = new System.Text.StringBuilder();
System.Windows.Forms.CheckedListBox.CheckedItemCollection col = clv.CheckedItems;
foreach (Object obj in col)
{
//
newText.Append(obj.ToString() + ", ");
}
t1.Text = newText.ToString();
if (t1.Text.EndsWith(", "))
{
t1.Text = t1.Text.Substring(0, t1.Text.Length-2);
}
}
Zippy
|
|
|
|
|
thank you for the help but i'm using a listView not a listBox. the listView doesn't have an event for selectedvaluechanged.
thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
trying to use CAPI, so I included the header on top of my WIN32 console app:
#include "stdafx.h"
#using <mscorlib.dll>
#include <tchar.h>
#include "wincrypt.h" <--- remove this, all problems are gone?
using namespace System;
// This is the entry point for this application
int _tmain(void)
{
return 0;
}
C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\WinCrypt.h(37): error C2146: syntax error : missing ';' before identifier 'HRESULT'
The error trace to this line here:
#ifndef _HRESULT_DEFINED
#define _HRESULT_DEFINED
typedef LONG HRESULT; <-- THIS LINE
Any idea?
norm
|
|
|
|
|
This here is the C# forum, you want to go to the C++ forum.
Norm Almond:I seen some GUI's in my life but WTF is this mess
Leppie:I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
But, i already figured it out. Smart arses from MSDNS omitted:
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <wincrypt.h>
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
man, just can't stop picking on MSDN people - perhaps I sufferred too much in my distant past doing MFC. Must say, reading their doc isn't the most efficient thing i do.
norm
|
|
|
|
|
I need to get the intersection of Green and Yellow in ARGB format
Is there a function for this.
And yes I know Color.GreenYellow exists but I need to know how to get intersections to achieve other mid way points.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Yellow is green and red together, from memory. Whatever it is, get the RGB value of red, green is obviously 0, 255, 0, and build a lookup table, or a function.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
but how do I calculate an intersection?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Well, assuming that yellow is RGB 255, 255, 0, and green is obviously 0, 255, 0, there are 255 intersection points. Like so:
0, 255, 0
1, 255, 0
2, 255, 0
3, 255, 0
You get the idea.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Yes but since green is 0,128,0 and green yellow is 0,173,28 and yellow is 255,255,0
a simple matter of adding 1 to red does not get me any closer to the intersection since its not a linear equation.
I was hoping someone would know a math formula to calculate the intersection of the three planes basically.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
How can green be 0, 128, 0 ? It is green, as is any value with 0 red and 0 blue, but hard green is 255, surely ?
In any case, the system works the same way, forget greenyellow, it's obviously not the point halfway between the other two. Instead, add 2 to your red value for every 1 you add to your green value. Write up a program that does that and draws a gradient and see how it looks.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
thanks
By the way those are colors from the color namepsace. so obviously thier not dark colors
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Yeah, I guessed where they were from. I guess they have a dark green or something...
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|