.net

avoid ListView data binding on each page load

Is there a way to maintain the data in listview whenever I click pages in the pager?. Because,the data what I am displaying is static. So, I don't want to go to database again or put it in a session and rebind it. ...

Declaring FileIOPermission on special folders

I have read over the documentation, scoured the interwebs, and it seems what I want to do cannot be done without writing a custom CAS permission. So, here's my last ditch attempt. I want to DECLARATIVELY define a FileIOPermission (Attribute) on my class to demand permission to the users MyDocuments directory. This directory is not consi...

How to get descended bound withoud rendeing full control

How can i get full union bounding box of control with all of its descendant controls, with out display full control, For example i have a panel in which i am displaying the child item. when panel have control that are visible VisualTreeHelper.GetDescendantBounds(myPanel); return the desired result, but if some items are not visible d...

Overloading Getter and Setter Causes StackOverflow in C#

I am not sure what is causing the StackOverflowException when I try to overwrite a get and set function. When I just use the default get and set it works. enum MyEnumType { .... } public MyEnumType data { get; set; } But when I try to add additional data, it throws a StackOverflowException public MyEnumType data { get { re...

Structuremap, consturctor that takes a list of plugins.

I got an interface like this public interface IWriter { ... } and a class public class WriterMerger { public WriterMerger(IEnumerable<IWriter> writers) ... } I want structuremap to fill out the constructor argument on WriterMerger with all registered IWriter's. I registered the different writers with StructureMap.ObjectFact...

Best and shortest way to evaluate mathematical expressions

I know there are many algorithms to evaluate expressions, for example By Recursive Descent Shunting-yard algorithm Reverse Polish notation But is there any way to evaluate any mathematical expression using C# .net reflection? or other modern .net technology? Thanks a lot ...

set int column in DB to null

Hi, I'm looking for a point in the right direction to solving this problem. I am being passed an object from the ui. One of the values is for a foreign key (an int which allows nulls). The value being sent is -1 which signifies that the value has not been set by the user. How can I write this object to the db setting the foreign key ...

What .Net buisness logic layer frameworks do you use ?

Hi I've been asked to extend a simple legacy application by adding a few tables and classes in it to extend functionality. This is a .Net 1.1 application which I have now successfully upgraded to .Net 3.5 Now my problem is that for these new tables and classes I wanted to add an ORM and a business logic layer that I can in the future...

Getting the first sheet from an Excel document regardless of sheet name with OleDb

I have users that name their sheets all sorts of crazy things, but I want to be able to get the first sheet of the Excel document regardless of what it is named. I currently use: OleDbDataAdapter adapter = new OleDbDataAdapter( "SELECT * FROM [sheetName$]", connString); How would I go about getting the first sheet no matter what it...

VSTO Outlook integration - Outlook shutdown event for synchronization

I'm working on a VSTO Outlook 2007 add-in that basically synchronizes Outlook data with web service. There are three types of synchronization that I want to have in the app: startup sync, manual sync and sync on shutdown. The first two as simple and are already done. However I have problems finding an appropriate event to fire to handle...

Getting the Current Logged On User from a different User Session

Hi Guys, I'm running a .Net application as a service under a special application user. From this service, i would like to get the User Name running the currently logged in session. I tried getting the user name that owns the Explorer.exe process, but the restricted user does not have access to this as it throws an exception if i try an...

MS Access 2007 forms for .net developers

I need to work with Access to create a form based solution - does anyone know of any good quickstarts / tutorials aimed at .net programmers for this? Everything I have found is aimed at Access beginners where all I need is a foot up to save time trawling through each control etc. ...

How to present formatted information on a .Net form?

Greetings Stackers, I have a simple little application that performs some analysis of all our corporate clients, and generates a score for each one based on their activity (think "traffic light" happyness system). Now, the score that's generated gets it's information from a variety of metrics, and spits out what can appear to be an arb...

How to implement autoscroll in DataGridView?

I have datagridview that has 25 to 100 rows. I am performing a task in seperate thread .Each row depicts a single task. I am selecting the row on which task is performing, if suppose the row is 15 which is invisible then I want to move that row to the visible area. It will autoscroll to the selected row.. ...

Win32 API function to programatically enable/disable device

I am writing a small C# app to disable a device (my laptop touchpad) whenever another mouse device is detected, and enable the touchpad again if a mouse is not detected. I am not even able to disable the touchpad in device manager (it is running on the default mouse class driver). I am getting into device driver development so I though...

Comparison of CI Servers?

I am searching for a comparison of different continuous integration (CI) Servers (esp. focusing on .NET) and couldn't find any. Therefore I'd like to know what you think about the different solutions available, what are the pros and cons, what are the hosting requirements and why CI Server XY is the Server of your choice. I am interest...

Scaling Image to multiple sizes for Deep Zoom

Lets assume I have a bitmap with a square aspect and width of 2048 pixels. In order to create a set of files need by Silverlight's DeepZoomImageTileSource I need to scale this bitmap to 1024 then to 512 then to 256 etc down to 1 pixel image. There are two, I suspect naive, approaches:- For each image required scale the original full ...

Does WeakReference work with String?

In .NET 3.5, Does WeakReference work with String or shall I wrap it in a small "class" to make it work with it? ...

How do i get from Stopwatch.GetTimestamp() to a DateTime?

Duplicate of: How to get timestamp of tick precision in .NET / C#? How do i get from Stopwatch.GetTimestamp() to a DateTime Assume Stopwatch.IsHighResolution is true ...

Is there a ApplyPropertyChanges with a datacontext?

I have seen an example using the entiyt framework and it sued the ApplyPropertyChanges method to update an entity. Is there an equivilent method in plain old Linq-To-SQL? My applicaiton is an asp.net MVC app and when I run my Edit action I want to just call sometihng like: originalObject = GetObject(id); DataContext.ApplyPropertyChang...