|
Hi,
you could:
1. collect all (or a significant range of) key values in a new collection (e.g. ArrayList)
2. randomly pick one out there and search your dictionary for it.
Even when the dictionary evolves, there is probably no need to repeat step 1
all the time in order to perform performance tests...
(
Luc Pattyn
|
|
|
|
|
I have been considering something slightly different, but along these lines, which is to build a schedule of actions and store them in a list, and then run through the list of stored actions.
Sure would be nice to have the equivalent of an array subscript into the dictionary or key colleciton, tho.
Mike
---------------------
www.opusedge.com
|
|
|
|
|
OK this is I need to do.
1. How to insert picture in RTB ?
2. How to print in WSISYG manner RTB?
I know regular way of printing is to open StringBuilder&StringWriter, etc. Which work fine for flat text.
But overall I believe I need to specify one printFont at end of this method and that is all... not what I want.
What if I want to print document with pictures and lot's of different fonts (multipage...). Is there some better way to do this?
Thanks!!!
|
|
|
|
|
Any idea please... I searched MSDN but only solution is throught win32 api or something, anyhing .net only?
|
|
|
|
|
OK I did it using this method
http://support.microsoft.com/kb/146022
can someone explain to me bit simplified what they actually did there?
|
|
|
|
|
I would like to set up my .NET C# application so that I can connect to it from another C# application and access various properties and methods.
I could probably achieve this with "Register for COM Interop", but it seems as though there should be a much simpler way using purely managed code.
I suspect (& hope) this is probably really easy and that I'm just missing something simple, but I can't seem to figure it out or find any references to this online.
|
|
|
|
|
Have you looked at .NET Remoting?
only two letters away from being an asset
|
|
|
|
|
Hi all,
I have using FileSystemWatcher class so as to watch particular folder. If any new files get copied to it, windows explorer open the folder automatically. It works fine with console application but when it's been created as a windows service, it doesn't work. The code ---
public class JobClass
{
public void startJob()
{
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Filter = "*.*";
watcher.Path = "c:\\DMSTemp";
watcher.EnableRaisingEvents = true;
watcher.Created +=new FileSystemEventHandler(watcher_Created);
Console.ReadLine();
}
void watcher_Created(object sender, FileSystemEventArgs e)
{
Process process = new Process();
process.StartInfo.FileName = "explorer.exe";
process.StartInfo.CreateNoWindow = true;
process.StartInfo.Arguments = "c:\\DMSTemp";
process.Start();
}
}
From the onStart() event of WindowsService, JobClass's startJob method is invoked.
protected override void OnStart(string[] args)
{
JobClass jobClass = new JobClass();
jobClass.startJob();
}
Any idea?
Thanks,
milan
satan
|
|
|
|
|
I have an MDI form. A child form (frm1) can be launched from the MDI's menu. A contol on the child form launches another form (frm2) whos parent is the MDI form.
When I launch frm1, it is launched as Maximized. When I launch frm2 from frm1 I launch it as windowstate Normal. However, it doesn't launch as normal. It launches as maximized. How can I fix this?
|
|
|
|
|
This seems to be expected behavior, much like opening a new document in Visual Studio when existing documents are displayed as maximized.
/ravi
|
|
|
|
|
Hi all
I'm new to C# and .Net 2.0 multithreading system.
I read about Thread.BeginCriticalRegion() and Thread.EndCriticalRegion() function to ensure that when the user call Abort() for a thread, this executes until the end of the critical region before it exits.
What I would like to know is what happens if the CriticalRegion is inserted in a try/catch block with the handling of a ThreadAbortException ?
Does it behaves the same( it executes until Thread.EndCriticalRegion() )? or does the exception is thrown immmediately even in the middle of the CriticalRegion area?
Reagards
ManuStone
|
|
|
|
|
The behavior seems to be dependent on the CLR host. According to MSDN[^], some hosts may decide to unload the entire app domain rather than take the risk of continuing execution in a potentially unstable state. If the app domain isn't unloaded, it appears that the code will execute until EndCriticalRegion() is called, afer which control will transfer to the catch() handler.
/ravi
|
|
|
|
|
Hi Ravi
thank you for your response.
Regards
manStone
|
|
|
|
|
Is it possible to use foreach with enums?
basically this is what I want to do:
public enum Color
{
red,
blue,
green
}
public class ColorStar
{
public ColorStar(Color c);
public static List<Color> MakeAllColors()
{
List<Color> colors = new List<Color>();
foreach (Color c in Color)
colors.Add(new ColorStar(c);
return colors
}
}
I know about Enum.GetNames and Enum.GetValues, but I don't want the names or values I want the actual enum items.
|
|
|
|
|
I think this should do what you want:
foreach (Color c in [Enum].GetValues(GetType(Colors))) {
...;
}
/ravi
|
|
|
|
|
Yeah, that did it... evidently I completely misread some documentation the first time I looked at it.
Thank you!
|
|
|
|
|
I am writing a program in Visual Studio .NET 2003, and as such I am using version 1.1 of the .NET Framework.
I need to include a function to ping a remote computer, and, while it is easy enough to pass it into the command prompt, I don't know of any way to read the result of the ping attempt.
MSDN says that there is a Ping class in .NET 2.0 and 3.0 (System.Net.NetworkInformation.Ping - system.dll), but that doesn't really help me, as it's not in .NET 1.1
Is there any way I can import the functionality from .NET 2.0 (I have the Framwork and C# 2005 Express installed), or is there any other way to ping and receive a result?
I would really appreciate some help with this, as I need to make this program for work.... and I need to have it done by Monday afternoon.
Thanks again,
MartyExodus
|
|
|
|
|
|
I suppose you could access a v2.0 assembly (dll) from a v1.1 executable.
The method I have that wraps the ping is:
<br />
public static System.Net.NetworkInformation.IPStatus<br />
Ping<br />
(<br />
string HostName<br />
)<br />
{<br />
System.Net.NetworkInformation.IPStatus result = System.Net.NetworkInformation.IPStatus.Unknown ;<br />
<br />
try<br />
{<br />
result = (new System.Net.NetworkInformation.Ping()).Send ( HostName , 1000 ).Status ;<br />
}<br />
catch<br />
{<br />
}<br />
<br />
return ( result ) ;<br />
}<br />
You don't even need the express version, just the SDK.
|
|
|
|
|
You can use the StandardOutput property of the Process class to capture the output of a commandline application.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
Ha. Thank you everyone for your quick responses. However, I'm still having a slight problem, possibly due to that fact that i didn't articulate my original problem.
ednrgc and PIEBALDconsult - The reason that i didn't do as the two of you said is simply this: System.Net.NetworkInformation doesn't exist in .NET 1.1, and as such, the Ping class doesn't exist either (Or I possibly don't know how to access them, but I'm pretty sure I'm right)
dan neely - I believe this method will work, however, I'm rather uncertain as to HOW to use it. This is what I have so far:
using System;
using System.Diagnostics;
using System.IO;
private void ping(string computer)
{
string args = "/k ping " + computer;
Process p = new System.Process()
ProcessStartInfo ps = new ProcessStartInfo("cmd", args);
p.StartInfo = ps;
p.Start();
StreamReader s = p.StandardOutput;
MessageBox.Show(s.Readline);
}
The command prompt loads correctly, but alas, the StreamReader fails, and the MessageBox does not show. It generates an InvalidOperationException, and simply states "StandardOutput has not been redirected."
Thanks everyone again for the quick response, and hopefully, you can help me further.
Thanks,
MartyExodus
|
|
|
|
|
|
Hey, thanks a lot.
While I'm not using the exact code from the article you posted... (simply because I'd like to LEARN rather than simply USE) you've inspired me to learn how to use sockets - something I should have done a long time ago.
But again, thanks to all who posted.
-MartyExodus
|
|
|
|
|
MartyExodus wrote: simply because I'd like to LEARN rather than simply USE
Then you have a bright future!
led mike
|
|
|
|
|
MartyExodus wrote: PIEBALDconsult - The reason that i didn't do as the two of you said is simply this: System.Net.NetworkInformation doesn't exist in .NET 1.1,
I understand that. But I meant compile the method into its own v2.0 dll and reference it from your v1.1 executable. You said you have the Express version so you must have the v2.0 dlls and compiler. I haven't tried it, nor do I have a way to try it.
|
|
|
|