|
Why don't you give it a try?
|
|
|
|
|
The docs state:
"You can create a component to watch files on a local computer,
a network drive, or a remote computer."
I'll let you decide if that means yes or no
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: I'll let you decide if that means yes or no
Neither, it means he don't need no stinkin documentation!
led mike
|
|
|
|
|
Hello,
I have an application that I run on my machine with VB2005 .net. Works good.
I take the exe to another machine and the application shuts down. We traced the program to the line:
thisconnection.open() - the application will execute the line but never come back(?). The app will just end.
We think that it is due to permissions or a missing component installed on the 2nd machine.
The program is at this point trying to open an odbc connection to a remote site to get information via sql call. (Again, this will work on the 1st machine without any problems (open, execute and closes just fine the odbc connections).)
Has anyone ever come across this problem or have an idea on a solution?
Sincerely,
Lmnorms1
|
|
|
|
|
lmnorms1 wrote: or a missing component installed on the 2nd machine.
Yes, part of the responsibility of software development is to learn (study, understand, know) about deployment issues. Here are a few of those issues.
* Know how to determine all the components that your application is dependent on.
* Know how to construct an Installer that will install all the components that your application is dependent on.
* Learn how to use Google to find documentation that one can read to learn things that one doesn't know but needs to.
led mike
|
|
|
|
|
Actually, found it. Thank you for the information. The information did help me in building the file properly.
The odbc connection was due to the odbc was not registered. It was built and could be seen in the user dsn but was on showing up in the odbc.ini file in windows. This tells me that it was not registered. Deleted the odbc and set it up again through the ODBC wizard in windows and it worked on the second machine.
Thank you,
Patrick.
|
|
|
|
|
Hi
I need to dial to a modem using RAS and than communicate to a TCP server using tcp client.
If I test RAS and TCP connection in isolation (using sample applications) both are running fine. However when use them both in the order
1. RAS call
2. TCP connection using TCP client.
I am getting following exception:
System.Net.Sockets.SocketException: An error message cannot be displayed because an optional resource assembly containing it cannot be found
at System.Net.Sockets.Socket.ConnectNoCheck()
at System.Net.Sockets.Socket.Connect()
at System.Net.Sockets.TcpClient.Connect()
at System.Net.Sockets.TcpClient.Connect()
at SerialCommunicator.TcpConnection.Connect()
at GosHawkII.Forms.FormMain.ConnectTcpClient()
at GosHawkII.Forms.FormMain.Connect()
at GosHawkII.Forms.FormMain.MenuItemConnect_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at GosHawkII.Program.Main()
Kindly advice what I need to do to achieve the desired results
Thanks in Advance
Manoj Kaushik
|
|
|
|
|
kaushik_Manoj wrote: because an optional resource assembly containing it cannot be found
You need to find out what that assembly is and why it cannot be found
led mike
|
|
|
|
|
hello friends
i am a new user of .net
i have done my exercise of inserting data from vb.net to excel sheet.
my next job is to geting data from excel to windows form in .net
|
|
|
|
|
What have you tried so far? A simple google search should reveal several available techniques.
|
|
|
|
|
I'm probably blind, but doesn't .NET provide a quicksort or other sorting algorithm? Sure, they're a dime a dozen on the web, but I prefer a solution that's built into the framework before reaching elsewhere.
And yes, I know about Array.Sort and its variations. But I want to sort a field in a DataTable and I need a custom comparator.
[edit]Heh. Found this[^] Linq example (second post)
[/edit]
Marc
modified on Wednesday, October 8, 2008 8:47 AM
|
|
|
|
|
|
|
|
Please describe your problem in detail
Cheers!!
Brij
|
|
|
|
|
Hello,
I'd appreciate some suggestions how to solve the problem exposed below.
I apologize in case that's too easy and I cannot see the solution myself.
Thank you in advance.
<code>
using System;
namespace KeepAliveEventsExample
{
/// <summary>
/// How to garbage-collect an instance which is kept alive only by
/// event handlers without removing the handlers explicitly?
///
/// Client runs a procedure. It holds a reference to an
/// object able to raise an event. Inside the method (Run)
/// an instance is created which can subsrcibe to the event.
/// The event handler keeps the subscriber alive even if the subscriber
/// reference is not reachable by the client.
/// In order to allow the garbage collection an "Unregister()" method removes
/// explicitly the event handler.
/// We wish a solution in order to get to the same result without calling any explicit method
/// like Unregister()
/// </summary>
/// <remarks>
/// - No Dispose Pattern
/// - No new Threads
/// </remarks>
class Program
{
static void Main(string[] args)
{
Client client = new Client();
client.Run();
Console.WriteLine("RUN FINISHED. PRESS A KEY");
Console.ReadKey();
client = null;
Client.FullCollect("LAST COLLECTION");
Console.WriteLine("FINISHED");
Console.ReadKey();
}
}
/// <summary>
/// A client of publisher / subscriber
/// It keeps a reference to the publisher but not to the subscriber
/// </summary>
/// <remarks>
/// While a reference to the publisher is held, no reference
/// to the subscriber is reachable outside the method "Run()"
/// </remarks>
class Client
{
/// <summary>
/// The client holds a reference to the event publisher
/// </summary>
private ObjectWithEvents obj;
public Client()
{
obj = new ObjectWithEvents();
}
public void Run()
{
Observer _subscriber = new Observer(obj);
//we should see _subscriber reacting
obj.DoSomething(5);
obj.DoSomething(10);
//we would like to eliminate this method
_subscriber.Unregister();
//the subscriber is not reacheable [only through the event in obj]
_subscriber = null;
//here we would like _Subscriber NOT TO REACT without having to do anything
obj.DoSomething(15);
//We would like to be able to collect _Subscriber here
FullCollect("COLLECTION 1");
}
~Client()
{
Console.WriteLine("FINALIZING CLIENT");
}
/// <summary>
/// Try to trigger possible collections in all generations.
/// </summary>
/// <param name="message"></param>
public static void FullCollect(string message)
{
for (int j = 0; j <= GC.MaxGeneration; j++)
{
for (int i = 0; i <= GC.MaxGeneration; i++)
{
GC.Collect(i, GCCollectionMode.Forced);
GC.WaitForPendingFinalizers();
}
}
Console.WriteLine(message);
}
}
/// <summary>
/// Subscribes to the event of ObjectWithEvents
/// </summary>
/// <remarks>
/// Instances of this object might be kept for the whole application lifetime
/// or just used for performing some operations.
///
/// Implementing the Dispose Pattern is not ok because in the real
/// application this would have a deeper meaning for the user
/// </remarks>
class Observer
{
/// <summary>
/// We can hold a reference to the publisher. This won't generate a problem
/// Also shows that, if we want, we have the publishers available
/// </summary>
ObjectWithEvents _publisher;
public Observer(ObjectWithEvents eventPublisher)
{
_publisher = eventPublisher;
//here we register to the event. This instance is going to
//survive garbage collection because the publisher keeps it alive
//through this handler
_publisher.ValueChanged += new EventDefinition(handler);
}
/// <summary>
/// Unregister the event handler in order to allow GC
/// We would like clients not to have to call this method
/// </summary>
public void Unregister()
{
_publisher.ValueChanged -= new EventDefinition(handler);
}
void handler(object sender, int value)
{
Console.WriteLine("VALUE CHANGED TO: {0}", value);
}
~Observer()
{
Console.WriteLine("FINALIZING SUBSCRIBER");
}
}
/// <summary>
/// Event definition
/// </summary>
/// <param name="sender"></param>
/// <param name="value"></param>
delegate void EventDefinition(object sender, int value);
/// <summary>
/// An object able to raise an event
/// </summary>
/// <remarks>
/// Instances are unaware of subscribers
/// </remarks>
class ObjectWithEvents
{
int _value;
public event EventDefinition ValueChanged;
public void DoSomething(int value)
{
_value = value;
//raise the event.
if (ValueChanged != null)
ValueChanged(this, _value);
}
~ObjectWithEvents()
{
Console.WriteLine("FINALIZING PUBLISHER");
}
}
}
</code>
|
|
|
|
|
Either keep the Unregister, or implement IDisposable with an if(registered) Unregister(); pattern.
If you really, really, really want to get rid of this unregister then I suggest you try to knock up a generic event proxy that uses weak references to refer to the observer, and can unregister and drop itself when the weak reference goes dead.
|
|
|
|
|
Hello,
thank you very much for your answer. The solution with a weak reference was already implemented and it is good to know that it was not only the outcome of a "disperate" programmer (...me). The problem is that some subscribers should survive when they are reacheable directly (not only through the event) so the client should provide that kind of information. Again the client has to think about memory management somehow. It would be perfect to be able to find out where the instance (subscriber) is referenced and check if only the events are keeping it alive. In case of other references the proxy could be restored. But I don't know how (and if it is possible). Anyway you gave me the courage to keep "Unregister" or the like...and this is big value.
|
|
|
|
|
Here is an excellent article about this topic published on codeproject recently: Weak Events in C#[^]
|
|
|
|
|
Thank you very much. That's the kind of information I was looking for. Also refering to another answer, now I know how the proxy was meant (and that was NOT the way I implemented killing any possible new idea...)
|
|
|
|
|
You are welcome
|
|
|
|
|
Hello
I have a column in crystal report which can display both float values as well as integer values...
Using formatting i set the decimal notation as 000.000 it is working fine for float.. but for integer values also it displays decimal part (like 5.000) I want it to be displayed like an integer 5
Any options available in reports/??
Thanks in Advance...
Salai
|
|
|
|
|
You set a formula to the number of decimal places in number Custom Style dialog.
In that formula you resolve if the number is integer or float. If it's an integer you return 0 (meaning no decimal places) and if it's a float you return 3 if you want three decimals.
Another option is to create a new formula field and use type conversion functions etc such as CStr. Then place this field into the report.
The need to optimize rises from a bad design
|
|
|
|
|
Mika....
Thanks it worked fine...
Thank you so much
Salai
|
|
|
|
|
You're welcome
The need to optimize rises from a bad design
|
|
|
|