SqlConnection - is remote or local connection?
How can I determine is it local connection (localhost or 127.0.0.1) or is it remote connection (other machine in local area) if I have SqlConnection object? ...
How can I determine is it local connection (localhost or 127.0.0.1) or is it remote connection (other machine in local area) if I have SqlConnection object? ...
I'm developing an application for a Windows based tablet PC. This application is pretty much a port of an application I already developed on a Windows Mobile device using .NET CF. I want to write the application from scratch, taking advantage of all of the knowledge I've gained in software development. I'd also like to write this new ...
Hello everyone, I am using VSTS 2008 + C#. Is there any way to get the informaiton like, whether we are currently in dual monitor mode, how much is the current resolution of each desktop? BTW: there are two modes of dual screen, duplicate screen or extended screen. I need a solution as well to distinguish between the different modes. ...
When you try to access a key which isn't in a Dictionary (for example), here's the stack trace you get : at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) .... .... (my own code stack trace) Like most people probably do, I log this errors when they occur, ...
I have often encountered an error such as "cannot convert from 'method group' to 'string'" in cases like : var list = new List<string>(); // ... snip list.Add(someObject.ToString); of course there was a typo in the last line because I forgot the round paranthesis after "ToString". The correct form would be : var list = new List<stri...
I have windows forms (.net 2.0) control that contains a splicontainer inside. Splitcontainer, as usually, contains 2 panels (standard thing). The Autoscroll is set to true. I've been struggling for quite a time to achieve something like synchronizing those two panels, so scrolling one of these will scroll the second one also. I achieved...
i have this problem to find a particular xml node l have post this problem on stackoverflow and some nice fellows suggested xpath. I am an xml newbie . please I need an c# code to find the parent , parent, parent as (great grand parent) then the first child ,lastchild , lastchild . the code have to iterate up the tree and down again. B...
I am trying to create a list of LINQ to SQL objects which i will add to the datacontext and insert later. When i do call SubmitChanges() though I get an error saying the Postcode foreign key for the WeatherForecast object is null. I appears that when List.Add() is called it doesn't do a deep copy of the dependent objects. Is there anyw...
I've been working on a .NET library. Of course .NET has a good way of working with configurations, and therefore I can document to library users what they should put in their app.config. However I've also to expose the library as a COM object, for legacy support. Some users of the library will be VB6 applications, which doesn't have a...
I'm trying to make a button which displays an image and is active only where that image is at least partially opaque. How do I take the Image and get a Region that I can set on the button? ...
I want to develop a small utility for windows and I prefer doing that in c# because it is easier (I'm a java developer). The utility will be available for download by many people and I assume some of them will not have the .net framework installed (is this assumption correct, say I target win xp and above?) My question is: can a c# ap...
byte[] imageData = null; long byteSize = 0; byteSize = _reader.GetBytes(_reader.GetOrdinal(sFieldName), 0, null, 0, 0); imageData = new byte[byteSize]; long bytesread = 0; int curpos = 0, chunkSize = 500; while (bytesread < byteSize) { // chunkSize is an arbitrary application defined value bytesread += _reader.GetBytes(_reader....
We're experiencing several cases where on loading up a project that was otherwise OK, gives an error in the Winforms designer along the lines of: Could not load file or assembly 'MyLibrary, Version=1.4.3419.14461, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. And Visual Stu...
I'm a bit confused. Got project which is covered by unit tests in different assembly. Co-developer created another project + another unit test assembly too. Now we want to mix some logic between both unit test projects (object factories, some initialization tasks, injection/mocking helpers, etc.). That would cause his project to referenc...
Hi fellow coders, I have a question that's not really a problem, but something that made me a little curious. I have a class with two methods in it. One is a static method and the other one is an instance method. The methods have the same name. public class BlockHeader { public static BlockHeader Peek(BinaryReader reader) { ...
In another SO question, I've seen several people recommend me to always use TryGetValue. While I always use TryGetValue over the Contains?/Access pattern, I avoid this pattern on purpose when I expect the key to always be in the dictionary. I then go for a direct indexer access, so that an exception is raised if the key isn't there, bec...
Is it possible to run a .net application on Linux environment? If yes then how? Will all the components of .net framework work properly on Linux ? ...
I'm looking for an advanced level VB.NET book which covers LINQ and Lambda Expressions. Generally I read C# .NET books due to lack of good VB.NET books when it comes to generic .NET Framework related subjects. However Lambda and LINQ is quite different in C# and VB.NET I'm looking for an advanced level VB.NET book on this subject. Any ...
In .NET properties are supposed to be first class citizens however in the IL code property getters and setters are implemented as get_PropertyName and set_PropertyName. class Property { int Value { get { return 42; } } int get_Value() { return 6 * 9; } void set_Value(int i) { } // Error even though Value is a read only prope...
I have a windows service running which moves files from a watched folder (IO.FileSystemWacher) to a UNC share on a network. The network share is secured, but the share has full control for the Service user; despite this I get problems with the file path not being found. I intend to impersonate the service (current) user, but am not su...