Answer Questions
LokiSD How to know when a remote object is no more available
Hello, Is it possible to know when a remote object is no more available. I mean something like the OnClose event of the MFC CAsyncSocket class. Marco Hi Marco, Remoting doesnt provide this kind of server events. There are couple of options that you can try 1. Implement a ping method on the server that clients can periodically ping to check the health of the server 2. Implement a callback mechanism and then make the server invoke all clients in its InitializeLifetimeService method (which should be called when the server's lease expired) to let them know its going down. Hope this helps. Hi, I got the same problem with my remote object. The workaround I used was to create an empty method ...Show All
rahsoftware Find a folder's location problem
I try to find a folder located on my C: which maches a specific name using: Directory.GetDirectories(@"C://", "folders name", SearchOption.AllDirectories); but when it checks a folder that has no access I got an interruption. System.UnauthorizedAccessException was unhandled How to solve this problem thats actually probably not the best way Mahesh for this scenario, and it is recommended to only catch the specific exception where it is most likely to appear, so using the try { } catch block is more appropriate, catching the specific exception type. this is just for your information! :-) Hi, ok, If you know the user who having access to c:\ ( required path ) you can impersonate the user before ...Show All
jamil Read File Contents into Array
Dear All, I am new at C# so sorry if this sounds a bit simple. How do i read the contents of s text file into an array I think i need a struct array, as i have four seperate values that i want to read in, namely product code, quantity, buying price, selling price, all I have at the moment is my struct set up i.e.; struct stockItems { string productCode; string quantity; string buyingPrice; string salePrice; } I have set up a new class which will contain all the methods which will manipulate the file, but was stuck on how to read in a previous files data into an array. Also if possible could you point me in the right direction for once the file has been read, being able to search through the array, ba ...Show All
WalangAlam Simulating HTTP Post
Hello all, i have made an HTML document which allows me to upload a file to a website without actually visting it. I am using C# and i wanted the way i could do the uploading part programatically so that there is no user intervention. I tried using HttpWebRequest and HttpWebResponse classes but in vain. Any method to simulate the file upload is appreciated. Inshort i want the replicate the action of the HTML file below , programatically using C# Thanks for taking your time off and reading this post. Have a nice day/night :) ---------------------------------------------------------------------------------------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head><title>RapidShar ...Show All
GrandpaB Memory issue
Hi! I don't understand the .Net memory magnagement. I have a application, when run it .... consume 16.280 KB of RAM, if i don't touch the app(idle) ... this value is constant along hours, but if i minimize the app then consume 8.000 kb, if and then maximize again consume 12.000 KB ... whats happened Thanks to all, specially to Chris Lyon - MS Regards. I have seen similar where my application consumes a lot of memory, expected mind you, and doesn't release it, at least in viewing Perfmon, until on minimize. I did not see a significant spike when maximizing it...but I wasn't doing any mayor GUI processing which caused a significant increase. RizwanSharp, It is NOT true that a huge garbage collection ...Show All
leclerc9 textbox values -> database
Im beginner in c# , but I want to learn so I need Yours help 1. I have form (watch link), I need to : - fill first box - fill second box when I clik button those textboxes should be saved in my database(I have one table : id(int),nazwa(varchar) I need example of button_click which insert to database pls help http://img149.imageshack.us/my.php image=form1xh3.jpg hello I have read some articles, and I made to my test this project http://rapidshare.com/files/12449287/dbSample5.zip works 'great' for me :) but another question: - what and how should I do to : a)automatic fill 'id' record (from 1 to ...),so textbox for 'id' should not be visible b)how can I show in form1 records from database within datagridv ...Show All
Al Zuniga {"Object must implement IConvertible."}
I keep getting this even though I have defined everything that has been suggested in all the forums :-( - HELP! I used this fine in VS 2003 - can anyone tell me the replacement in VS 2005. I have a public function that is called at various times that I need to execute a Stored Procedure. I get an error at the =>DBExecuteQuerySP = cmd.ExecuteReader(CommandType.StoredProcedure) It tells me to check my 'inner exception' - and that shows the subject line as error: {"Object must implement IConvertible."} My FUNCTION: 'Executes a SELECT Stored Procedure and returns a SqlDataReader containing the results Public Shared Function DBExecuteQuerySP( ByVal cmd As SqlCommand) As SqlDataReader Dim co ...Show All
prasad knv Culture Not Supported Error
Hi, I installed .NET application (C#) in Vista RC1 and tried to run it and when we make a web service call we get the following error, There is an error in XML document (1, 1479). ---> Culture name 'en-in' is not supported The web server is Windows 2003 server. As i analyzed the locale set at Vista RC1 client machine is English (India) which is not available or supported by Windows 2003 Server. How to resolve this issue. Regards, Jeevanantham.S If the locale is not supported by Windows Server 2003 there is little you can do about it. I suggest you explicitly set your client's thread and UI culture info to a server-supported supported culture and/or send a compatible HTTP A ...Show All
Spyrrho ftp upload through http proxy
Hi, I'm trying to upload a file to a server. Now when I'm testing it at my site. I get no problems. However, when the solution is deployed at the customers end, we get the following problem: "System.Net.WebException: An exception occurred during a WebClient request. ---> System.InvalidOperationExcepti on: The requested FTP command is not supported when using HTTP proxy." So the client is using a http proxy, and no uploads work. So is there a workaround I can do in the code, to accomodate the proxy Regards Irfan Habib What do you use FtpWebRequest If the Proxy property is set, either directly or in a configuration file, communications with the FTP server are made through the speci ...Show All
sanjeevm Why doesn't my C# form show the contents of the database?
Hi All, I'm using VC2005 in C# trying to create a windows app that displays the contents of the tutorial northwind.mdb. I've followed the tutorials and created a dataset and dragged the customers column onto the form and it all compiles and runs fine but none of the elements on the form get filled in with the contents of the database, also the BindingNavigator has no items to navigate. What am I doing wrong and how do you make the app automatically load in the northwind database and display the contents on the form Are you getting any exceptions from the x64 compiled code Is your connection string correctly indicating the 64-bit odbc drivers Thanks for the info. I have a problem then. I am at the start of ...Show All
Dylan Beattie Best Practice - Implementing Dispose / Exposing the Disposable Resources
I apologize if this thread is in the wrong forum. Our general rule of thumb is if our class owns a class level unmanaged resource or a managed resource that contains a Dispose method then we implement IDisposable on our class. So, for instance, we have a class level DataTable that we instantiate from within the class, since it has a Dispose on it, we implement dispose. No problem there. My question is, if we expose that class level DataTable that our class owns via a property, or return it via a function or even return it via a reference parameter....should we still clean it up via dispose We are divided here at our shop. I say no, my boss says yes. We are currently cleaning it up in the dispose. 8) My thought is we are sending t ...Show All
LouArnold Random Number Generator Problem
Hi all, I cannot seem to solve this problem: I am attempting to generate a unique filename with the help of the Random Number Generator (RND.Next.ToString). All seems to work fine except that one third of the time, I get duplicate file names; this poses a critical problem for my application. The problem only seems to happen when Method1 calls Function2 to generate and return the random file name. If I move the logic to generate the filename into Method1, it works properly. I have tried to use SyncLock, etc. but to no avail. Why is it that when Method1 calls Function2 to generate the random file name, I get duplicates, whereas if I move the logic from Function2 into Method1, I get no duplicate file names. Is this due to threading ...Show All
Keithyboy1 Querying a XML file with XPath fails
Hi, I wrote a VC# application targeting the .Net Framework 2.0 (source code below). It uses a System.Xml.XmlReader to load a file (the file is well-formed); a XPathDocument built from the XmlReader object; a XPathNavigator gotten from the XPathDocument to process XPath queries. When testing this program with a simple query ( //s/@epsilon ) it returns an unexpected object : MS.Internal.Xml.XPath.XPathSelectionIterator . The result should be 1.5 . Any help would be appreciated. Intenion The problem you had was that the XPath returned a node set (the 'epsilon' attribute node) so the 'Evaluate' method returned an object representing a node set - XPathSelectionIterator. If you know the XPath will return onl ...Show All
Kevin French FileSystemWatcher.Created does not fire for files on a Unix NFS Share
I have a directory on a Windows server that is also a NFS share (with Services for Unix). I created a FileSystemWatcher and configured for the .Created event. When i copy a file to that directory locally on the windows machine the event fires. When i copy a file to that directory from a unix box using the NFS share the event does not fire. The file does show up in the directory though. Here is the code I am using to create the FileSystemWatcher. FileSystemWatcher filewatcher = new FileSystemWatcher (); filewatcher.Path = @"C:\FromUnix" ; filewatcher.Filter = "*.*" ; filewatcher.Created += new FileSyste ...Show All
R.Papa Circular Buffer in .NET
Is there a collection in .NET that offers a circular buffer If not is there a collection that I can extend that would offer this functionality Thanks Hmm not quite sure why nobugz mentioned an exception nevertheless you can still use a queue and dequeue whenever you enqueue. Its probably more memory efficient (and very simple) to create an array and an index to refer to the next element to overwrite e.g. public class CircularBuffer<T> { T buffer[]; int nextFree; public CircularBuffer(int length) { buffer = new buffer[ length ]; nextFree = 0; } public void Add(T o) { buffer[ nextFree ] = o; nextFree = ( nextFree +1) % buffer.Length; } } ...Show All
