.net

Insert server datetime using a SqlCommand

I have a SqlCommand which inserts a datetime into column using a SqlParameter. At present I use DateTime.Now as the value of this parameter. I believe this will add the datetime on the user's PC which is not consistent. How do I change this so the datetime of the database server is inserted? EDIT: I should have made it clear this wa...

PasswordDeriveBytes vs Rfc2898DeriveBytes, Obsolete but way faster

Guys, I'm working on a encryption functionality based on classes inherited from SymmetricAlgorithm such as TripleDes, DES, etc. Basically there're two options to generate consistent key and IV for my algorithm class, PasswordDeriveBytes and Rfc2898DeriveBytes, both inherit from DeriveBytes abstract class. The PasswordDeriveBytes.GetByt...

c# webbrowser show what you want

hi i want create small web browser , tiny and fast but i have problem , let me explain : 1 - user enter site : google.com 2 - c# program get google.com 3 - find <td nowrap="" align="center"> 4 - in web browser only show that area i dont know where i must start , thanks ...

TransactionScope in .NET application

Hi All, I have written a code block to do database transaction in SQL Server database. I am using TransactionScope class to rollback all the changes if any failures during the execution. If I run the application in a system which running SQL SERVER, I have no problem. If I run the application in a system and the SQL SERVER is running i...

DevExpress TreeList - Show the tree outline in a column that is not the first

I am using the DevExpress TreeList in a .NET WinForms application to show hierarchical data. The outline column (the one with the indents and the plus/minus buttons) is currently always the first column, even if the user moves columns around. Is there any way to use a different column for this purpose? Thanks in advance! ...

Image resizing efficiency in C# and .NET 3.5

I have written a web service to resize user uploaded images and all works correctly from a functional point of view, but it causes CPU usage to spike every time it is used. It is running on Windows Server 2008 64 bit. I have tried compiling to 32 and 64 bit and get about the same results. The heart of the service is this function: p...

C#/.NET how to highlight certain rows in DataGridView

hello, i have a datagridview that is filled by setting its DataSource to a DataBinding. now i want that certain rows in the datagridview have a different backgroundcolor according to some value in the row itself. how can i accomplish this easily? thanks! ...

How can I prevent the Print Progress dialog appearing when performing a print preview

In my C# application, I'm attempting to generate a print preview without the progress dialog appearing on screen. I believe you can use PrintDocument.PrintController to prevent this when printing for real (i.e. not a print preview), however it doesn't seem to work when performing a print preview. My code is as follows: public FrmDeliv...

How to reuse WPF ScrollViewer to create my own scrollable control?

I'm trying to improve the graph drawing control that comes with Graph#. It's good, but things get out of hand when you start dragging nodes around. This is my first encounter with WPF, so this is probably a newbie question. :) I have the GraphCanvas control which has nodes and edges on it. They can be dragged around which changes their ...

How does one have developers on VS2008 target .net 2.0 (but not the service pack) to avoid runtime crashes?

So, I want to upgrade my development team to VS2008. As an enterprise, we haven't rolled out the 3.5 runtime yet. From some reading, it seems like installing VS2008 will automatically give you .net 2.0 SP1, which has some new APIs, and when you target 2.0 runtime it will assume 2.0 SP1. But if SP1 is not rolled out to our users, this ...

How to add scrollbars to your custom control in WPF?

After asking this question I realized that perhaps I should have asked a more generic question. So, here goes: In WPF, I'm creating a custom Panel-derived control. To that control I would like to add horizontal and vertical scrollbars and control them myself (get & set min/max/value/pagesize). How can I do this? This is my first encoun...

Unit test for a method that takes a HttpResponse object as a parameter. OutputStream is not available.

I am trying to create a unit test for a method that takes a HttpResponse object as a parameter. What the correct way of doing this? I hope you seasoned unit testers out there can help me. Additional information: I tried creating a fake HttpResponse object by passing in a StringWriter. StringBuilder sb = new StringBuilder(); Stri...

Creating a 360° panarama from a deep zoom image in Silverlight?

I created a deep zoom image with Silverlight 3.0, but I want to make it into a 360° image. How do I do this? ...

Is there a good reference for data annotations in regards to how DataType works?

I have a customer class which has both PhoneNumber and Email properties. Using DataAnnotations I can decorate the properties with DataType validation attributes, but I cannot see what that is getting me. For example: [DataType(DataType.PhoneNumber)] public string PhoneNumber {get; set;} I have a unit test that assigned "1515999A"...

List of availible cultures

Hi, I have a WinForms application which can be localized through satellite assemblies for the resx-files. The user can switch the application language at runtime. So my question is: Is there any way to dynamically find out which cultures are shipped as localized resources with my client? ...

display all ie versions under one application

I had an application/browser that would show me the website under different versions of IE I would select which version and it would display the page through the lenses of that version Not able to find the program, can you please point it to me ...

Visual Studio: Is there a way to collapse all items of Solution Explorer?

I know that I can use Arrow Keys to collapse items of solution explorer one by one, but I would like to know if there is a way to collapse all items with only one operation. I want to know it because, today I have a solution with 6 projects that have at least two hundred files and if I try to collapse them one-by-one I will have a hard t...

SharePoint, Workflow and Web Services - restart workflow

Can you restart a workflow or push a workflow to its next step using SharePoint Web Services? If so which web service do you use? If you change a field like "Status" and the workflow uses this to know what it should do next... will it "nudge" the workflow forward? ...

.NET/MVC JSON response opens up dialog box to save

I am trying to submit a form via jquery's ajax method in my .net mvc application. I've set the dataType to json and the contentType to "application/json; charset=utf-8". In my controller action, I'm returning a JsonResult. For some reason, the JSON response doesn't get handled correctly and instead I get a dialog box to save a file ...

Date function problem in SQL and Linq

I issued a SQL on SQL Server 2000: select * from Employee where LastUpdateDate >=DateAdd(yyyy,-1,Getdate()) It works fine and got some records. Then I write a Linq for the same purpose: EntityQuery<Employee> query = from e in ctx.GetEmployeeQuery() where e.DateCreated >= DateTime.Today.AddYears(-1) b...