|
I know i can do so through network connection window but i need to do it through code...
|
|
|
|
|
You will get some hits when searching CP for "network sniffer" or something similar.
|
|
|
|
|
I have a console application spanning multiple methods and functions, and based on a flag value I wish to abort program execution.
Is there any other method other than break(which cannot be used always)?
Thanks!
h.
|
|
|
|
|
You basically want something like this, I can't help more without knowing more.
static bool abort;
static void Main(string[] args)
{
while (!abort)
{
DoStuff();
}
}
|
|
|
|
|
Have you tried Environment.Exit() ? It worked for me
|
|
|
|
|
Thanks. Environment.Exit() works. I was not aware this function.
|
|
|
|
|
Environment.Exit() not working for you?
|
|
|
|
|
|
I am creating a custom control like listbox. So I need to implement CollectionProperty which will open collection editor to add the items at the design time. I succeeded in creating collectionclass and item class. But I am not able to set this to property. It shows (collection) in the property. But when I open collection editor and add new item, it is showing System.Object . I am not able to get my item class properties there. Could any one point me to the right direction to implement collection properties. Any urls' also will be helpful.
|
|
|
|
|
You need an indexer (aka Item) that sets and gets the Type. Also the Type, needs a default constructor.
|
|
|
|
|
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 );
}
}
}
}
|
|
|
|