|
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.
|
|
|
|
|
Cool, FxCop Runner[^] provides an integration that's comparable to the built-in code-analysis. Going to try it tonight
Bastard Programmer from Hell
|
|
|
|
|
Hello,
There namespace Company.Service01, which contains classes and interfaces.
There namespace Company.Service02, which contains classes and interfaces.
Both spaces have the same structure of, contain the same classes and interfaces.
I need to somehow ensure that I could work with class (for example: Eso9PortClient) from this namespace,
depending on the input parameters of the program.
It's possible there is some technique to it?
The goal is that I did not have to repeat the same code n times the number of namespaces.
Example:
file01.cs
namespace Company.Service0X
{
public interface Eso9Port {...}
public partial class FaultInfo {...}
public interface Eso9PortChannel {...}
public partial class Eso9PortClient {...}
}
file02.cs
namespace Company
{
class Program
{
static void Main (string [] args)
{
if (args [0] == "01")
{
MultiService MultiService m = new ();
m.CreateOrder ();
}
else if (args [0] == "02")
{
MultiService MultiService m = new ();
m.CreateOrder ();
}
else if (args [0] == "03")
{
MultiService MultiService m = new ();
m.CreateOrder ();
}
}
}
public class MultiService
{
public void CreateOrder ()
{
// Work with the instance Company.Service0X.Eso9PortClient
// depending on the parameter in class Program
Company.Service0X.Eso9PortClient Company.Service0X.Eso9PortClient x = new ();
string xx = x.orders
...
}
}
}
Thank you in advance for your reply
|
|
|
|
|
Use an Abstract Factory pattern
|
|
|
|
|
Firstly, take out common code and put that in base classes in a base interface, and make sure that each implementation implements a common namespace. The main driver code shouldn't have to store references to any of the specific company namespaces. Then the problem simply comes down to creating an instance of the main object within one of the namespaces.
Depending on how flexible you want your system to be, and whether you permit runtime plugins, you either want a hard-coded factory:
class MultiServiceFactory {
IMultiService Create(string name){
if(name == "01") return new Company.Service01.MultiService();
else if(name == "02") return new Company.Service02.MultiService();
else throw new ArgumentException("Can't make a service for "+name);
}
}
... or you need to use reflection to look up the requested name ("Company.Service"+name+".ClassName") in either the current assemblies or loaded runtime plugin assemblies. I won't go into the entirety of plugin architecture in a Q&A reply, there are plenty of articles on CP about it.
|
|
|
|
|
Hello Experts,
I have assign work for creating add in for PowerPoint. In which i want toolbar in Powerpoint slide. So can any one pls help me for this issue.
I have no deep knowledge for Powerpoint Addins.
Thanks
If you can think then I Can.
|
|
|
|