|
Create a Windows service and use the FileSystemWatcher class. You will get an event every time your file has been changed.
Patrik
|
|
|
|
|
That might be suitable for the OP's requirements, but not mine.
|
|
|
|
|
I have a app that list users that are locked out but it shows this in my combobox
billy-Noel Schmitlin,OU=Quality-Labo,OU=Users,OU=Soultz,DC=jacob-wonder,DC=com
i just want it to show "Billy-Noel" just the users name
what i have searched removes the CN= but thats it
<br />
strName = strName.Remove(0, 3); <br />
Thank you for your time.
|
|
|
|
|
Hi,
Split() on the first char you don't want, I guess that is a comma.
And read up on string class.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Some mupet-numb-nuts gave you onesy, so I've dropped a five on top to make it better.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
or you could try:
int i = yourString.IndexOf(",");
string s = yourString.SubString(0,i);
|
|
|
|
|
Thanks for the help ill give that a go.
-Summey
|
|
|
|
|
Good people,
We have created a .NET application that will include several MP3 music files. We have approximately 12 MP3 files. These files are quite large (some are around 11MB). Therefore, our installable executable file is also quite large.
We plan on reducing the size of the MP3 files, however, I was wondering if there was some sort of best practice or common way to include music files in your .NET software application? If I zip up all the MP3 files, how do I tell .NET installer to unzip the files into the correct directory?
Thanks,
Blitz
|
|
|
|
|
Zipping MP3's generally doesn't help
|
|
|
|
|
MP3 is a compressed format, and it's lossy, hence it gives a quite good compression rate. Zipping MP3s won't usually reduce their size enough to make a difference.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Hi! You have seen programs like TeamViewer. How can I monitor the desktop of another computer and send the information to a client using C#. How can I film the desktop and send it like a stream video?
Can you give some directions on what approach to take?
Still learning...
|
|
|
|
|
|
nike_arh wrote: Still learning clueless...
Fixed a minor inaccuracy for you.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I've done one in C++, it won't be very hard to so in C# as well. As you seem to be clueless from your previous posts, may be your should hire someone else to do it for you.
In case you wondering my charges are $500/hr it may take me around 6 weeks to complete ( so you are looking $500 * 40 * 6)
|
|
|
|
|
|
Thats 240 000 cans of coke (in my country)
|
|
|
|
|
only
|
|
|
|
|
Im using a SerialPort in order to connect a client and a server through modem.
I write some AT commands in the servers' modem buffer, and the client makes the handshaking correctly. The AT commands are written when the DataReceived Handler is triggered.
The problem is that when handshaking finishes and communication is established, I cant use the handler to detect new data , I have to do a loop, reading the serialport input buffer constantly. Is there a way to trigger the event handler and read data instead of using a loop?
Any help would be apreciated and excuse my english if I made a mistake
Ivan
|
|
|
|
|
I often use serial ports and other similar way of communicating to instruments and devices, and personally I prefer to write a thread for reading incoming data.
You can have the thread loop and check on incoming data and if any, read it all up (or up to a maximum of "n" bytes), and insert a Thread.Sleep(1) in the loop or similar to avoid using up all the CPU time.
You can use events to break the thread on closing the serial port and cleaning up, or even a simple boolean.
You must of course use some locking to ensure thread-safe access to the serial port object.
I've been using this technique for quite a few years, and it works quite nice IMO.
Hope this can help, if you need it I can give you some code snippets, just let me know.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Thanks for your suggestion Moreno!
Yeah, I think thats the best way to do this task, but...
Im using GUI to report and show the status of each serialport (Im using 60 instances of it, I have 60 COM ports). For example, report if CD is on, CTS, if its reading, writing and so on... so I would have to make 60 threads for each serialport, plus main thread which manages all the GUI stuff, so I think I would have to use some sort of thread cross communication, and I'm not good at that topic . However, I'm googling that.
BTW if someone have any good resource about threads communication (sharing data between them), it would be very useful.
Thanks!
Ivan
|
|
|
|
|
I understand your doubts: threading can be a pain if you're not used to it, but it pays off.
My best suggestions is you create a wrapper class which includes all the serial port functionality, for example:
using System.IO.Ports;
internal class MySerialPortClass
{
...
private SerialPort MySerialPort = null;
...
internal void Open()
...
internal void Close()
....
internal void Send(string Message)
}
The class will also contain your thread and start/stop it automatically, for example upon creation/distruction or upon opening/closing the serial port.
To handle thread-safety you can simply use locking on the serial port object every time you access it, since that's the only shared resource. For example:
internal class MySerialPortClass
{
private object MySerialPortLock = new object();
...
internal void Open()
{
...
lock (MySerialPortLock)
{
MySerialPort.Open()
}
...
}
...
}
And the same technique must be used on any other property in your class that will be accessed by the read thread. For example, if you store the communication results in some variable and then access it from other threads, then you must use locking on it.
Finally, you can set up events for anything you want notification about. End of communications by either reading the answer from the device or timing out is the basic event you will need, but you can also add others depending on your needs. For example:
internal class MySerialPortClass
{
internal delegate void CommEndDelegate(string Result);
internal delegare void CommErrorDelegate(string ErrorMessage);
internal event CommEndDelegate OnCommEnd;
internal event CommErrorDelegate OnCommError;
...
private void DoOnCommEnd(string Result)
{
if (OnCommEnd != null) OnCommEnd(Result);
}
...
private void DoOnCommError(string ErrorMessage)
{
if (OnCommError != null) OnCommError(ErrorMessage);
}
...
internal void MyReadThreadRoutine()
{
...
DoOnCommEnd(Result);
...
DoOnCommError("Timeout");
...
}
...
}
This will make it easy to link the class to your GUI.
It's just a raw example, but I hope this will help you. Good luck!
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
This is really useful. Thanks a lot Moreno!, I'll try this...
|
|
|
|
|
Hello,
I use sql connection to show data in datagrids.
I want to put progress bar that will show the progress of the connection itself (from the opening of the connection, throught the collecting of the data with the queries and to the closing of the connection).
How can i do it?
|
|
|
|
|
Don't think you can the way you want.
I think the best you will be able to achieve is to report a progress value in between each step of the sql stuff, i.e.
report progress
open connection
report progress
run command
report progress
close connection
report progress
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|