|
Thanks, Could you please show me a some sample code or article where I can find more information on this ?
|
|
|
|
|
Hello,
N a v a n e e t h wrote: I succeeded in creating collectionclass
I guess like that:
public class YourItemsCollection : CollectionBase, IDisposable
{
}
For this class you have to write an converter, which inherits from "System.ComponentModel.ExpandableObjectConverter".
public class YourItemsCollectionConverter: ExpandableObjectConverter
{
}
In this class you have to override following methods:
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] filter)
The "YourItemsCollectionConverter" has to be set as an Attribute to "YourItemsCollection":
[TypeConverter(typeof(YourItemsCollectionConverter))]
This article[^] shows it very good!
-- modified at 8:18 Monday 30th July, 2007
-- modified at 8:34 Monday 30th July, 2007
All the best,
Martin
|
|
|
|
|
Thank you martin. It was excellent. Thank you very much
|
|
|
|
|
You are allways wellcome!
All the best,
Martin
|
|
|
|
|
Hi,
I am a new to Visual Studio.NET but not to development and require assistance; after downloading Plug-in samples from codeproject and the Microsoft sample,
and finding issues with deprecation etc using Visual Studio 2005 .NET.
The MS sample performs some form of conversion and I suspect this is in relation to the PluginCollection class, which now causes an issue with
ConfigurationSettings being replaced with ConfigurationManager, and naturally the following type cast is no longer supported:
m_plugins = (PluginCollection)ConfigurationSettings.GetConfig("plugins");
I am attempting to develop a plug-in host capable of displaying usercontrols plugins on a panel in the same manner as the codeproject sample
(ExtensibleUI_demo) but using the Microsoft framework by adding the IPlugin Interfaces to the welcome class. E.g.:
public partial class Welcome : UserControl, IPlugin
I have managed to develop an application based on the ExtensibleUI_demo to work, but the plug-in name details are not added to the listbox, and I am not sure
how much of this framework is no longer applicable or appropriate best practice.
Can anyone assist? it is my intention to use plug-ins to replace database forms, displaying them on a parent container such as a panel.
Regards
dotman1
|
|
|
|
|
Did you see my article on creating Plug-ins with .NET? It even has a sample application to test the plug-ins.
|
|
|
|
|
Thanks Joseph,
No I had not noticed your article; the article is well documented and clear, the demo code what can I say this is exactly what I was trying to achieve, its good to see someone else also appreciate class diagrams. I will revisit my prototype as I did manage to get a prototype working with the support of an article “Plugins in C# by Redth”, obviously there is nothing wrong with this approach yours lends itself to my personal style and approach.
Greatly appreciated.
dotman1
|
|
|
|
|
|
Hi
two comments
1.
take richTextBox1.Lines out of the for line and the for block,
so do:
string[] lines=richTextBox1.Lines;
int linesLength=lines.Lenght;
for (int a = c; a < linesLength; a++) {
selectionlength += lines[a].Length + 1;
...
}
That will give a dramatic difference because now the string array has to
be generated once instead of 100,000 times.
2.
If you don't need the extra capabilities of RichTextBox, don't use it at all.
Your app seems line-orineted; I can't tell whether you use colors, bold, etc.
If not, consider a ListBox, it is faster at anything it does (and it only
selects entire lines).
|
|
|
|
|
Luc Pattyn wrote: 1.
take richTextBox1.Lines out of the for line and the for block,
this must be good idea and i will try it.
Luc Pattyn wrote: I can't tell whether you use colors, bold, etc.
If not, consider a ListBox, it is faster at anything it does (and it only
selects entire lines).
yep
Luc Pattyn wrote: 2.
If not, consider a ListBox, it is faster at anything it does (and it only
selects entire lines).
but how can i find "[ID]=1234" in listbox
thanks buddy
Becoming Programmer...
|
|
|
|
|
Hi,
ListBox (and ComboBox) have two find methods: FindString and FindStringExact;
and these have an overload that takes a starting index.
If interested I suggest you look it up in MSDN...
But before changing all your code, give it a try with my first suggestion
(and tell us the new speed).
|
|
|
|
|
|
Hi,
I may suggest that (considering you are just manipulating text) you should rely on the Find() method of the rtf :
int positionFound=Find(text,startPosition,endPosition,options)
I think you should use 'Find' to get the position of the '[END]' tag and not use a loop , as in your exemple.
Hope it helps
|
|
|
|
|
i m not getting you, can you explain little bit more??
"I think you should use 'Find' to get the position of the '[END]' tag and not use a loop , as in your exemple"
but how can i know the lenght of between [ID] and [End]???
Becoming Programmer...
|
|
|
|
|
Sure...
* assuming you have a form with 2 rtf , and a button to copy from richTextBox1 to richTextBox2
* assuming you only deal with text
the code below should do the trick in no time
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace rtfTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
richTextBox1.Text = "[ID] = 0000\nlines\n[END]\n[ID] = 1234\nlines for 1234\n[END]";
}
private void button1_Click(object sender, EventArgs e)
{
string beginTag = "[ID] = 1234";
string endTag = "[END]";
int startPosition = richTextBox1.Find(beginTag);
if (startPosition >= 0)
{
startPosition = startPosition + beginTag.Length+1;
int endPosition = richTextBox1.Find(endTag,startPosition,RichTextBoxFinds.MatchCase);
if (endPosition > startPosition)
richTextBox2.Text = richTextBox1.Text.Substring(startPosition , endPosition - startPosition );
}
}
}
}
|
|
|
|
|
yep thats also good way, i like, thanks
Becoming Programmer...
|
|
|
|
|
Hi,
Sorry, If I have posted this query to a wrong group!
I'm facing an issue with C# project. I use VS 2005 express edition.
I was developing a C# project and had couple of UI controls that I had placed
using UI editor. Everything was fine but now I can't view the "UI designer" now.
If I run the project I do get the UI that I had designed but cant edit it now?
How can I see the disigner again?
Thanks
Vikas
|
|
|
|
|
Hi,
Try to close the form and Rebuild Solution..and if the rebuild has succeeded..try to open your form again,sometimes i get the same problem but when i do that my UI designer can be view again
Kind Regards,
Tomi
|
|
|
|
|
I tried but still I can't see the form design! I guess, I will have to port the entire code into a new project now
|
|
|
|
|
Hi there .
I think , it's better to check your reference files.
Maybe you missed one of your reference . if it is , remove you reference from reference list and add it to your project reference again , and then Rebuild your solution or project , what ever as you want .
DMASTER
|
|
|
|
|
Hello,
What you can try:
In your project explorer, rightclick the Form or usercontrol you can not edit and change the "buildaction" to an other setting and then back to "compile" (I have not the english version and only 2003 so I don't know the exact names).
Then make a rebuild.
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hi, Ok I know why this is happening but pls tell me whats wrong in doing this?
1. My form is like this: Everything is proper and I can view the designer
<br />
<br />
public partial class Form1 : Form<br />
{<br />
}<br />
2. I need to have a special control class say MyPictureBox derived from PictureBox so added the code as follows in file Form1.cs:
<br />
<br />
public class MyPictureBox : System.Windows.Forms.PictureBox<br />
{<br />
}<br />
<br />
public partial class Form1 : Form<br />
{<br />
}<br />
Thats it: Now If I try to open the designer I get the error:
<br />
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. <br />
<br />
The service System.Windows.Forms.Design.ISelectionUIService already exists in the service container. Parameter name: serviceType <br />
Hide <br />
<br />
at System.ComponentModel.Design.ServiceContainer.AddService(Type serviceType, Object serviceInstance, Boolean promote)<br />
at System.ComponentModel.Design.ServiceContainer.AddService(Type serviceType, Object serviceInstance)<br />
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IServiceContainer.AddService(Type serviceType, Object serviceInstance)<br />
at System.Windows.Forms.Design.ComponentDocumentDesigner.Initialize(IComponent component)<br />
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)<br />
at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)<br />
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)<br />
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)<br />
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)<br />
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)<br />
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)<br />
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) <br />
Afterwards, I will not be able to view the original designer but I think the designer related to MyPictureBox which is blank.
But if I put the body of MyPictureBox after the body of Form as shown below, everything is fine!
<br />
<br />
public partial class Form1 : Form<br />
{<br />
}<br />
<br />
public class MyPictureBox : System.Windows.Forms.PictureBox<br />
{<br />
}<br />
Pls let me know what is the procedure in adding a derived UI control class?
Thanks
|
|
|
|
|
Hello,
The Problem is that both classes have design support.
It is not good practice to but them all in one file.
If you put the picturebox in a special file you will also be able to open it over the designer.
All the best,
Martin
|
|
|
|
|
Thank you Martin and others who gave quick answers!
I created another file and things are pretty nice now!
Help is really appreciated
|
|
|
|
|
Hello Every body,
I am new with crystal reports. I want to generate report for those employees whose age is more than 50 yrs.
But I am not able to do so .It is showing all the records.
I had added an crystal report in my project.
I link it with the database through wizard only,
On form1 it had inserted an crystal report viewer. on the load event of the form1 I had used the following code but it is use less.
SqlConnection Connection = new SqlConnection("server='server1'; user id='sa'; password='admin'; database='employee'");
SqlCommand myCommand = new SqlCommand("SELECT * from companyEmp where age < '50'");
myCommand.Connection = Connection;
myCommand.CommandType = CommandType.Text;
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = myCommand;
DataSet DS = new DataSet();
DA.Fill(DS);
crystalReportViewer1.SetDataSource(DS.Tables[0]);
crystalReportViewer1.ReportSource = objNewReport;
But it is still showing all the record of companyEmp.
Regards,
rahul saini
|
|
|
|