.net

Format the list items from the DataGridViewComboBox

Hello, I'm displaying prices on a DataGridView (on a WinForms application developped in C# on VS 2008). The column type is DataGridViewComboBoxColumn. The DefaultCellStyle.Format property for this column is set to "C2" and the prices are indeed formatted as currency in the cells of this column. However, when the user clicks the ComboB...

Unable to connect custom tracelistener class via app config - ConfigurationErrorsException

UPDATE - No need to answer this now, I have solved below. Hi, I'm trying to implement a custom trace listener in .NET, but having a problem adding the trace listener via the config file. I found a similar post on stack overflow but it doesn't seem to help (http://stackoverflow.com/questions/1176582/how-to-define-custom-tracelistener-in...

Prevent debugger to break on all Exceptions in a 3rd party library

Hi, I maintain an open source library that internally uses exceptions during a recursive method call. The exception is taken back on the call stack and in some cases handled, while in others it will be returned to the caller. The problem we are having right now is that some users are running Visual Studio Debugger with the "Halt on ALL...

problem when insert "\\" in MySQL table

when i insert a specific value in MySQL table through code i get exception (1064 error) i know the reason , but i don't know how to fix the problem,, all what i wanna to do is to store the relative path of my images in the image table then i get this exception all the time when the inserted string contains "\" or @"\". how can i fix th...

Programming with N-tier

What are the general guideline today for structuring a 3-tier application in Visual Studio 2010 with C#? Create blank Solution Create a class library to hold data sets Create a class library to hold data entity Create a class library to hold the business logic Create a class library to hold user interface (WPF or windows forms) Is t...

create subdomain like urls with username in .net

hi is it possible to rewrite url in .net in this way: username.mysite.com mapped to mysite.com/users.aspx?id=username ...

Replace \r\n Newlines using XSLT and .NET C# VS 2008

I use VS 2008, .net 3.5 for generate page html using XSLT. I have Message, that contains \r\n (newlines) I use this in XSL file: <b>Message: </b><xsl:value-of select="Message"/><br/> I need replace \r\n by <br/> in xsl. I have seen several references but not get solution for my issue: I use this code C# before I call to transform X...

In what situation Application_EndRequest is called but Application_BeginRequest is not called?

The expected order of HttpApplication methods is: Application_Start Init Application_BeginRequest Application_AuthenticateRequest (page life cycle) Application_EndRequest I'm passing through a situation, which throws absolutely no exception, in which, after the Init, it goes directly to ApplicationEndRequest. It doesn't call Applicat...

How to know how many event handlers for an event?

Hi All, How to know how many event handlers for an event? I want a way to execute the following code: // if (control.CheckedChanged.Handlers.Length == 0) { control.CheckedChanged += (s, e) => { // code; } } Note: this code is out side the control class. Thanks in advance. ...

Generate all possible combinations of several columns in .NET

I have like 4 columns in a file, each column contains a number of values, more or less. I need to get all possible combinations, while order of columns and number of sections in resulting strings should remain the same. E.g. first column contains numbers ranging 1-100, second: letters a-z, and the third one is also numeric, I would get ...

Strange casting behaviour. Cannot cast object (int) to long.

There is following code: int intNumber1 = 100; object intNumber2 = 100; bool areNumberOfTheSameType = intNumber1.GetType() == intNumber2.GetType(); // TRUE bool areEqual = intNumber1.Equals(intNumber2); // TRUE long longNumber1 = (long) intNumber1; // OK long longNumber2 = (long) intNumbe...

Using sharpsvn with a local repository

Hi all, I'm using sharpsvn dlls for .NET. I'm new to using subversion, and I'd like my repository to be on a filesystem and not on a remote server. Is it possible to use sharpsvn like this? I mean, have it checking out from c:\somewhere to c:\somewhere-else? ...

Streaming, custom serialization of huge objects in .NET

In .NET, I would like to call a REST-style web service which expects a POST body which is a binary serialization of a class on the following form: public class Test { public string Name; public byte[] Data; } The bitstream should be exactly the same as when using BinaryFormatter.Serialize(). The problem is that the Data member...

what's the result when call Initialize() for a byte[]?

byte[] bytes = new byte[100]; bytes.Initialize(); What's the default values in above bytes byte array after the Initialize() called? all null\0? ...

How to use inline modifiers in C# regex?

How do I use the inline modifiers instead of RegexOptions.Option? For example: Regex MyRegex = new Regex(@"[a-z]+", RegexOptions.IgnoreCase); How do I rewrite this using the inline character i? http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx ...

How do I stop a thread when my winform application closes

Hello, I have a singleton that has a running thread for obtaining records from a server. But when I stop my winform application the thread keeps running. I have tried to create a destructor in my singleton to abort the thread if it running, but it does not have any effect on the thread - I know that the destructor is being evoked. I am...

How to use Func with Entity Data Context?

i writed below codes MyCustomer.cs must return List which is type of Customer entity. İ used Func method. I want to do this: return erpEntityCtx.Customer.Select(select).ToList<TResult>(); BUT error return to me: Has some invalid argument. i can use this: return erpEntityCtx.Customer.Select(c=>c.Name).ToList<TResult>(); However ...

NSIS Installer with .NET 4.0

Is there a standard/preferred method for automatically downloading and installing the .NET 4.0 Framework from an NSIS installer, if the machine doesn't already have it? There are several examples for making this work on older versions of the framework, but seemingly none of them work for 4.0. Before I hack something together myself, I ...

Check keyvaluepair againt existing values in list of keyvaluepair

Hello, How can I check a new KeyValuePair against an existing list of KeyValuePair ? I want to compare for a condition to include or exclude the item. I am using vb.net 3.5 it is a nested For loop and I am deleting a datarow on the result of the condition args = (existing list of KeyValuePAir) For Each datarow As DataRow In ds.Tables...

System tray tooltip formatting

Hi, I am creating a NotifyIcon and then calling this to show a balloon-tip from the system tray: _trayIcon.ShowBalloonTip(100000, notifierTitle, notifierText, ToolTipIcon.Info); Everything works fine but I wondered: is there any way to format the text in a system tray tooltip? (In my case, notifierText) Obviously, I am adding newlin...