|
|
Thanks
|
|
|
|
|
I made a custom UserControl and in it i put a Listbox.
In Form1, in the properties of the UserControl I want to see the [Items] property of the Listbox that is inside UserControl.
How to do that?
thanks.
|
|
|
|
|
Create the property yourself, and delegate the get/set methods to the property on the listbox.
Regards,
Rob Philpott.
|
|
|
|
|
If I was knowing how to make it, i did not cry for help.
give me an example please.
|
|
|
|
|
Ok something like (in your user control):
public ListBox.Collection Items
{
get { return listbox1.Items; }
set { listbox1.Items = value; }
}
... (edit) although you probably don't want the setter thinking about it..
Regards,
Rob Philpott.
|
|
|
|
|
ListBox.Collection does not exist!
I found this but with a little problem:
public ListBox.ObjectCollection Items
{
get { return listBox1.Items; }
set { listBox1.Items = value; }
}
|
|
|
|
|
yeah, I edited the original - you can't set it, so just forget the second line and you should be there.
Regards,
Rob Philpott.
|
|
|
|
|
I figure it out and it works:
public ListBox.ObjectCollection Items
{
get { return listBox1.Items; }
}
But when i open Items property from the Property panel, a window appear (Object Collection Editor) and it let me add and remove items but with no capability of editing those items... how to solve that?
I observe that when i open Items property for the actual listBox1 another window appear (String Collection Editor).
How to add the (String...) instead of (Object...)?
The ListBox have only these classes available: ___(and no String Collection)
modified on Tuesday, June 21, 2011 8:59 AM
|
|
|
|
|
Set an Editor attribute
[Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design", "System.Drawing.Design.UITypeEditor, System.Drawing")]
(lifted from here[^])
|
|
|
|
|
in Form1 I wrote this and is working all right:
(BUT...I want to be able to add items not only programmatic, but from properties panel too.)
private void Form1_Load(object sender, EventArgs e)
{
StreamReader sr = new StreamReader(path + "\\Sessions.txt");
RichTextBox rtb = new RichTextBox();
rtb.Text = sr.ReadToEnd();
for (int i = 0; i < rtb.Lines.Length-1; i++)
{
session1.listBox1.Items.Add(rtb.Lines[i]);
}
sr.Close();
}
|
|
|
|
|
you don't need the richttextbox, you should be able to iterate through the lines of the StreamReader (ReadLine method)
V.
|
|
|
|
|
"you don't need the richtextbox""
And how do I take the lines from file (here:[for (int i = 0; i < rtb.Lines.Length-1; i++)]?
|
|
|
|
|
Just take a look at the documentation of StreamReader ; there should be a ReadLine() method.
Well, here's the link : StreamReader.ReadLine()
|
|
|
|
|
thx (with the while will do nice |)
But my first problem still is in debate
|
|
|
|
|
Sorry, I don't know how to customize the collection editor for your needs. This should be possible as there are some attributes that you can add to your USerControl that will let you customize their behavior.
Here's another link that could help you get the point
Hope this points you in the right direction.
|
|
|
|
|
Hi ,
I am using Visual Studio Professional edition.There is no Fxcop integration in that.Is there any third party tools/addons that can be used to run Fxcop ?
With regards
|
|
|
|
|
You could always try google: It lead me straight to MSDN: Visual Studio Integration of FxCop[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I lost interest in FxCop because it looked like it fell by the wayside. And then reading this post I had a look and Found FxCop 10.0. Don't know how good it is but it would be great to start using it again.
Downloading now
"You get that on the big jobs."
|
|
|
|
|
But why? FXCop does nothing to really help an experienced programmer, and often does more harm than good in its recommendations.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Even an experienced programmer makes mistakes, and it's said that the average programmer makes an error in every 10 lines of code. Static code-analysis doesn't cost much, just some CPU-time.
John Simmons / outlaw programmer wrote: and often does more harm than good in its recommendations.
It's not meant to be followed blindly; it's an analysis, and could help in identifying potential problems. I do like to argue about the recommendations, and fortunatly Microsoft provides a rationale for every rule - meaning one can disable the entire rule if the rationale doesn't apply.
..I might be a 'bit' biased though; made it a part of the daily-build proces
Bastard Programmer from Hell
|
|
|
|
|
Sure but I like to make sure my code and other team members meet a standard.
Also I worked on a very old slow system a while ago and ran FxCop over it. Something like 2,000 performance issues were highlighted, most you wouldn't pick up by just reading the code. Fixed them all and got a 12% performance boost! Ok, it's not a profiler but still worth using periodically.
"You get that on the big jobs."
|
|
|
|
|
Integrating FXCop into Visual Studio will do no good because you want to use it (FXCop) *before* building, but not as part of the build process. Just add it to your external tools menu and be done with it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Some IDE's have something similar integrated; Code Analysis[^] from the IDE, seems to return the same information. Isn't available in my IDE at home - different version probably.
Bastard Programmer from Hell
|
|
|
|
|
No.I got some tools likes Fxcop runner and Fxcop integrator.Its doing a nice job.
|
|
|
|