.net

How to initiate an uninstall of a ClickOnce app, from within the app?

Can I reliably initiate the un-installation of a ClickOnce app, from within the app? In other words, I want to give the user a big "Uninstall Me Now" button on one of the forms. When a user clicks the button, I want to start the windows uninstall process for this app, and perhaps close the app. Reason: We are dead-ending a ClickOn...

Create Lines around a guiding line using Miterjoin

Hi SO community! I am drawing graphs into a WinForms Picturebox. Now I am searching for a possibility to 'duplicate' a line (an array of points), so that the two resulting lines are positioned a fixed distance away from the original one. Like in this picture, I have the red line and want to get the black ones: I thought about just m...

What version of the .NET framework ahould I target?

I'm a desktop C# developer (that is not ASP) and am wondering about version targeting for small personal projects. These are, of course, trying to reach as wide an audience as possible, and so I've been targeting .NET 3.0 (which is the latest version on a Windows Vista system without any service packs) and 2.0 (which is simply the most ...

How do I shift items in an array in C#?

Let's say that I have an array of strings like this: 1, 2, 3, 4, 5, 6, 7, 8 and I want to shift the elements of the array such that The first element always remains fixed Only the remaining elements get shifted like so ... The last element in the array becomes the 2nd element and is shifted through the array with each pass. Pass ...

Forcing file redirection on x64 for a 32-bit application

The silent redirection of 64-bit system files to their 32-bit equivalents can be turned off and reverted with Wow64DisableWow64FsRedirection and Wow64RevertWow64FsRedirection. We use this for certain file identity checks in our application. The problem is that in performing some of theses tasks, we might call a framework or Windows API,...

Can anyone simplify this Algorithm for me?

Basically I just want to check if one time period overlaps with another. Null end date means till infinity. Can anyone shorten this for me as its quite hard to read at times. Cheers public class TimePeriod { public DateTime StartDate { get; set; } public DateTime? EndDate { get; set; } public bool Overl...

How to share the credentials between Webform and Winform?

Hi! I want to make a login form at the Clickonce deployment webpage, and only allow the authenticated users to download the application. and I want the downloaded application to use the same credentials entered at the webpage, without prompting the users to enter the credentials again. Details: I have an application(Windows Client) whi...

How to Make Top (or Bottom) Rounded Rectangle Corners in Silverlight?

So the Rectangle control has RadiusX and RadiusY property for making rounded corners. However, this affects ALL corners but I'd like to know if there's a way to just affect the top corners, or the bottom corners, etc. Is there a way? ...

LINQ to SQL - Save an entity without creating a new DataContext?

I get this error Cannot add an entity with a key that is already in use when I try to save an Item [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(Item item) { Global.DataContext.Items.Attach(item); Global.DataContext.SubmitChanges(); return View(item); } That's because I cannot attach the item to the global DataCo...

How do websites send email when new answers is posted to question

How do websites send email when new answers is posted to question like if you answer this question, I will get automated email that my question has an answer? ...

dll woes c# noob

Hi, I'm a bit of a visual studio noob. I have just restarted a project in which I am using NHibernate. The project worked fine last time I used it but now is giving the following error. System.IO.FileLoadException: Could not load file or assembly 'Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or...

Using WCF HttpBindings on a LAN

We have a WCF-based client server that operates over a LAN. We've been getting along ok by using the NetTcpBinding, chosen because we couldn't get either HttpBinding to work between hosts. (Within a single host works fine, but is not useful for the production environment.) We're now back at the point where we want to explore using eithe...

what is the order of this function's execution: var queryResult = names.OrderBy(item => item).Where(it => it.StartsWith("S"))

what is the order of this function's execution: var queryResult = names.OrderBy(item => item).Where(it => it.StartsWith("S")) ...

what is Entity Framework with POCO

What is the benefit of using POCO? I don't understand the meaning of Persistence Ignorance, what does this mean? That the poco object can't expose things like Save? I can't wrap my head around this POCO that there's alot of buzz around. What is the difference with the EF generated entities and POCO? ...

Is using the .NET Image Conversion enough?

I've seen a lot of people try to code their own image conversion techniques. It often seems to be very complicated, and ends up using GDI+ function calls, and manipulating bits of the image. This has got me wondering if I am missing something in the simplicity of .NET's image conversion call when saving an image. Here's the code I hav...

How to use error provider at run time along with associating any control to validate

I am trying to create a Validation in a reusable fashion. Purpose: Make the validation control reusable. Error Provider should associate with control passed dynamically and can be set or cleared at run time. When user press OnClick event then all the controls gets validated with their own Error Providers. public bool IsFieldEmpty(re...

Crystal Viewer PrintReport() very slow

I am using Crystal Viewer in a C# windows application. When I try to print the report using PrintReport() method, the print dialog opens after a long time (near about 45 minutes). How to fix it? Is there any other way to print the report? ...

Microsoft Chart Controls for Microsoft .NET Framework 4.0

In my Asp.Net 4.0 C# application I wanted to use chart control. Is there any chart control designed to work with asp.net 4.0 where my application is going to be deployed with the Azure Frame work. Suggest me with any informative links to move forward ...

How to refactor use of the general Exception?

Our code catches the general exception everywhere. Usually it writes the error to a log table in the database and shows a MessageBox to the user to say that the operation requested failed. If there is database interaction, the transaction is rolled back. I have introduced a business logic layer and a data access layer to unravel so...

How to cancel any event in winforms?

I want to cancel an event from within that function scope. Eg. I pressed button click event and on false validation, I want to cancel this event. Likewise i want to cancel other events also. How can i do this in C# ...