.net

Difference between UnhandledException and DispatcherUnhandledException in .NET

What is the difference between AppDomain.UnhandledException and Application.DispatcherUnhandledException in .NET? I need an event that is fired when any unhandled exception occurs. I have come across these two, but I dont know in what ways they differ from each other. Also, are there cases when they are not fired? ...

SELECT from datatable into datatable

I have three DataTables with data: table1 has columns AGE, FIRST_NAME, LAST_NAME, FAVORITE_COLOR, PHONE table2 has columns AGE, FIRST_NAME, LAST_NAME, PHONE table3 has columns AGE, LAST_NAME, FIRST_NAME, FAVORITE_COLOR, PHONE I also have a fourth table which I need to fill with all data from the three previous tables. table4 has colu...

Simple .NET CD/DVD burning component

There's a number of postings about IMAPI in .NET, including these: http://www.codeproject.com/KB/miscctrl/imapi2.aspx http://www.vbaccelerator.com/home/net/code/libraries/writing_cds/imapi/article.asp But I can't say they're straightforward. First link looks good, though its C# WinForms realization doesn't allow simple re-using in VB.NE...

Nothing != null - or does it?

Recently in a previous project I came across a peculiar difference between VB.NET and C#. Consider the following C# expression which: null <= 2 This expression evaluates to False which is what I would expect. Then the corresponding VB.NET expression: Nothing <= 2 I was surprised to learn that this expression actually evaluates to ...

Using Microsoft.Build.CPPTasks

Having a slight problem using these classes, although they're exactly what I'm looking for. MSDN gives absolutely no documentation for them. I've had a play, but executing the contained CL task gives a strange error about logging before initialized. The task doesn't actually seem to contain any initializing methods. Any suggestions? ...

How to get a MemoryStream from a Stream in .NET?

I have the following constructor method which opens a MemoryStream from a file path: MemoryStream _ms; public MyClass(string filePath) { byte[] docBytes = File.ReadAllBytes(filePath); _ms = new MemoryStream(); _ms.Write(docBytes, 0, docBytes.Length); } I need to change this to accept a Stream instead of a file path. Whats...

Check if the control has events on Click EventHandler

I want to know if a control has a method assigned on the Click event. Button b = new Button(); b.Click += (sender, e) => { }; /* What I want */ b.Click.Count // 1 I need something that can at least tell me if the control has or not some method on the click event. ...

protobuf-net and rpc over tcp

I'm looking for a rpc over tcp implementation that uses protobuf-net (or any other .net implementation of protobuf). Any suggestions? ...

how to store settings for deployable c# application?

I want to store settings for my C# application, such that default setttings can be easily shipped with my binaries and the end-user can change them using a simple text editor(or in some other simple way). I seem to face several alternatives : a .config file, .settings file or a .resx file. What are the pros and cons of these? Edit1: En...

How can I get the local group name for guests/administrators ?

Question: I use the code found at http://support.microsoft.com/kb/306273 to add a windows user. The problem is i need to add the user to a group, but the groupnames are localized. E.g. the MS-example uses an english computer, which means you can get the guest group like this: grp = AD.Children.Find("Guests", "group") But on a non-eng...

How do I properly simulate high latency on a C# socket server test?

I have a class that uses 'System.Net.Sockets.Socket' directly for network comunication, and currently I use the following two interfaces to break dependency on the Socket class : public interface ISocketListener { void Listen(int backlog); ISocket Accept(); void Bind(EndPoint endpoint); }...

ASP .NET Dataset to XML: Storage and Reading

Hi, [Below is the almost full Code modified. Currently shows illegal character error when being read]. I have a C# ASP.NET application which is currently reading an xml file from the file system and then loading it into a GridView control. In the grid I can Delete rows. There is also an file upload button below the grid which upload PDF...

Is there a .NET data-type smaller than a byte?

How about a Nibble etc. ...

How can I implement a cancel-button for a batch/queue routine?

Hi, I have a vb.net 2.0 program, that has a batch/queue routine to execute tasks that take a long while. One of the tasks is "upload to ftp" of large files. The queue is started by the user clicking the "start" button, and then a for-loop just runs over each batch item, and does whatever it needs. Now I want to implement a "cancel queu...

Expression and Parameter

I have this method: public static Expression<Func<MyEntity, bool>> MyMethod(string someId) { return o => o.SomeProperty.Equals(someId); } This is being passed to another method that uses entity framework with this expression to retrieve the matching items. My problem is it doesn't work. If I replace the someId as part ...

How do you set Textbox.Width to 100% in silverlight?

How do you set the width of a textbox to fill the container programmatically? For example in xaml if I have the following declaration for the textbox: <TextBox Height="23" Name="TextBox1" VerticalAlignment="Top" Width="50" /> how can I set the width so that it fills the container in a button click handler? ...

Sending DateTime from .Net to Java Web Service

Hi All, I am having some issues with a Java web service i have consumed into my simple outlook add in that i am trying to integrate with this 3rd party API. The problem is the difference between .Net dates and Java ones, i will be honest i do not know much about Java anymore. My problem is that the API is expecting a date in the forma...

Don't understand remoting activation

I have been working my way through the .NET Remoting Overview at http://msdn.microsoft.com/en-us/library/kwdt6w2k(v=VS.71).aspx , and I don't understand a couple of things, hope someone here can shed some light. In the Building a Basic .NET Remoting Remoting Application section, three assemblies are described: a remotable type, living...

SerialPort events won't fire on Windows Server 2008 using .NET 2.0 Application

I have a program that reads data from a scanner via the serial port. This program works fine on Windows XP. We have a terminal server set up running Windows Server 2008. I run HyperTerminal on our test terminal, it connects and reads the scanner data fine through COM1. I run my app on that same test terminal and get nothing when I sc...

Web service contains additional string tag

I am getting a web service response as below. It has additional XML tag and string tag in the response. I was not able to load this response into XMLDocument object in Dot Net. I have asked web service provider to remove those tags before sending response. But they said that this is the web service standard. Is it how web service suppose...