.net

.NET: WebBrowser, WebClient, WebRequest, HTTPWebRequest... ARGH!

In the System.Net namespace, there are very many different classes with similar names, such as: WebBrowser and WebClient WebRequest and HTTPWebRequest WebResponse and HTTPWebResponse Those are the main ones I'm curious about. What is each one's function? How are they different from one another? Also, in what cases would you use whi...

Index was out of bounds. For Loops and Arrays

I'm trying to create two arrays filled with a set of strings from twos tables in a database and then compare them. For example (array1[0]=1101 and array2[0]=0110). If the both respective characters =1 then perform an action. But when I run this code I receive the error Index was outside the bounds of the array. System.IndexOutOfRangeExce...

Live meeting/Shared view like real time screen sharing service on top of Azure?

What might be the considerations for building a real time screen sharing service (some where close to shared view or live meeting) on top of Windows Azure? Please share your thoughts. For this, it is obvious that we've to create a custom TCP/IP server - to which clients can connect to and exchange (publish/retrieve) data real time, over...

Navigation failed while using WebBrowser control in VS.NET 2008.How to resolve?

Hi I like to create a simple web browser in VS.NET'08.I finished coding but while running it shows "Navigation to web page was canceled".Help me resolve this problem.Though i invoked the Navigate function inside the constructor,its not working. public Form1() { InitializeComponent(); webBrowser1.Navigate("http://goog...

What is the difference between KeyValuePair and Hashtable in .NET?

I want to store the my custom collection as a Key and Value is also a collection of string List.I may achieve this using both KeyvaluePair and hashtable.What is the best suitable collction which gives me more advantage in terms of flexibility? ...

Is there any API in C# or .net to edit pdf documents?

Hi, Is there any API in C# or .net to edit pdf documents? Like I need to retrieve particular text and replace it with my own text. Thanks nRk ...

How to update clients which access a windows service on a remote server?

Update involves updating the binary and quite a few libraries. Please advise if this is possible by tweaking just the server side? Maybe, if I could just send a message with a link for the updates. Currently, There is no provision It uses a tcp channel configuration to communicate. ...

Override DateTime.ToString to use "o" instead of "G"

Is there any way in .Net I can get the default format used by DateTime.ToString() to change from ToString("G") to ToString("o")? I don't have the option of using a different overload it has to be ToString(). Update: I found a way to do what I need using DateTimeOffset but it was very useful to see Gonzalo's solution. ...

C# get width/height of image on web without downloading whole file?

I believe with JPGs, the width and height information is stored within the first few bytes. What's the easiest way to get this information given an absolute URI? ...

Render ASPX page at runtime from database

Hi, Assuming the code below: public class DynamicAspxHandler : IHttpHandler { bool IHttpHandler.IsReusable { get { return false; } } void IHttpHandler.ProcessRequest(HttpContext httpContext) { string aspxContent = PlainASPXContent(); Page page = CreatePage(httpContext, aspxContent); page.ProcessRequest(...

What event can I use when setting TreeView.SelectedNode = null?

When I set SelectedNode to null the tree updates correctly but BeforeSelect and AfterSelect do not fire. Is there any way to tell when the selection has been changed to null? My first thought is to extend the control and add an event though I would have thought something like this would already be available. ...

Caching System.Console output

We have some methods that output a lot of coloured text to the Console. It's actually a menu that is built by looping through a collection of data. Because we are writing item by item (and one line contains many items in different colours), this process is rather slow on low-end and mid-end machines. On those machines you can see each ...

C# WaitCallBack - ThreadPool

What is the exact purpose of WaitCallback delegate ? WaitCallback callback = new WaitCallback(PrintMessage); ThreadPool.QueueUserWorkItem(callback,"Hello"); static void PrintMessage(object obj) { Console.WriteLine(obj); } Can i mean "Wait" in the "TheadPool" until thread is availabe.Once it is available execute the target? ...

Ideas for creating a Calendar control

Hi, I am trying to develop a calendar control as shown in the following link. http://img143.imageshack.us/i/calg.png/ If you look into the date Nov 12th, you can see some records. The number of record will vary. So ideally the height of a row will shrink/expand based on the number of records. Please guide me how to achieve this. My ...

My software is consuming lot of memory. Any tools that'll help me in knowing whats causing it?

The software I wrote (C#, .NET, VS2008) does some simple image processing. I operates on the single image. Surprisingly its consuming more than 150MB which should not be the case. I want to know whats making it use this much of resources. Are there any tools that will help? ...

Run .NET application as administrator

Since Vista & windows 7 came out some of my .NET application has started throwing security exceptions. I've noticed that some applications (i.e. my antivirus, control panel) have a small shield and when I run these applications administrator privileges are automatically requested from me by windows. I know that as a user I can set the...

How can I do this Eager Loading (using the .Include() method) in this code?

Hi folks, I have a very simple repository I'm playing around with, using Entity Framework v4 that comes with VS2010 Beta 2. I'm trying to dynamically include the Include method, if a user optionally asks for it. eg. Public IQueryable<Foo> GetFoos(bool includeBars) { var entites = new Entities("... connection string ... "); v...

Writing a visual studio plugin?

I'm looking for resources on writing a visual studio 2008/2010 plugin, preferably a book of some sort. ...

Linq Projection

I have an Customer collection. Inside Customer I have another collection called Orders. Order have Name, OrderDate, PurchaseID. How do write a Linq query to give me a new customer collection that only contain Orders that have OrderDate > QueryDate? To aid with the discussion here is the relevant set of the code. I just need to underst...

User control in .Net during development

Hello I've noticed that when developing an user control in vs2008, that I have to build the user control each time I want to see the changes that I've made. Changes that usually doesnt requiere that I build the project aren't visible until I compile and build the project. This mean that it take a lot more time to develop since the site ...