.net-3.5

How to use ISynchronizeInvoke without a reference to the Form

I need to "send" a piece of code from another thread (Excel Interop) to the UI thread to execute. Normally you'd use Invoke on the Form, which implements the ISynchronizeInvoke interface: public class MyForm : Form { ... private void Button_Click(object sender, EventArgs e) { SomeExcelWorkbook.OnBeforeClose += delega...

Not Binding WpfToolKit:dataPicker through Converter

ConvertDateTime - return good string "01.10.2010" but datapicker not binding. if we replace datapicker on textbox - all works well help me, code: add: xmlns:loc="clr-namespace:StoreBags" add: <loc:ConvertDateTime x:Key="conkey"/> xaml add: <my:DataGridTemplateColumn Header="Дата" Width="100"> <my:DataGridTemplateColu...

asp.net embedded code with asp.net server control.

Hello, I have use embedded code to assign the value to label's text property.But the assign value is not rendering.Here is my code sample, <%lblProposedYear.Text="Hello"%> I can not display the text "hello" at the time of page load. Please help ...

Removing read only attribute on a directory using C#

I was successfully able to remove read only attribute on a file using the following code snippet: In main.cs FileSystemInfo[] sqlParentFileSystemInfo = dirInfo.GetFileSystemInfos(); foreach (var childFolderOrFile in sqlParentFileSystemInfo) { RemoveReadOnlyFlag(childFolderOrFile); } private static void RemoveReadOnlyFlag(File...

visual studio 2010 from 2005?

What happens if I compile and deploy solutions written in vs 2005 using 2010? Must the web server have 3.5 and 4.0 installed? Will my web.configs change? I'm talking mostly about standalone DLLs used in SharePoint and Web application solutions that use .net 2.0. Can I have vs2010 and vs2005 on the same development client? Is there...

How to perform updates in entity framework 3.5 within an SqlTransaction

I'm working on a plugin that gets loaded via IOC from a 3rd party data driver. The plugin and data driver both operate on the same SQL Server 2005 database, but the plugin focuses on a small subset of tables that have foreign key relationships to the tables that the data driver manages. My problem is that in some operations, the data d...

Replace left click behavior by ctrl-click behavior in a datagridview

I would like a DataGridView row selection to behave the same way than when holding the ctrl button down (Click a new row to add to selection, click again to deselect, etc.) But I want it using the left mouse button. Can I set this behaviour or will I have to do it programmatically ? ...

Is it absolutely safe to display a WPF window from a WinForms form?

I would like to display a WPF window from a windows forms application (.NET 3.5). This code seems to work without any problem in a sample project: public partial class WinFormsForm1 : Form { public WinFormsForm1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { WpfWindow1 w =...

Help creating a Control

Hello every body, I'm trying to create a Watch Control and dont realy know where to begin. My goal is to able do declare a watch like this. <Watch Shape="Round"> <WatchButton Watch.Angle="70"/> <WatchButton Watch.Angle="90"/> <WatchButton Watch.Angle="120"/> <Cadran Shape="Round"> <Needle/> <Needle/> ...

C# Configuration Manager

I have the following code: using System.Configuration; namespace test { public partial class MyService : ServiceBase { public static ReadConnectionStrings() { ConnectionStringSettingsCollection connections = ConfigurationManager.ConnectionStrings; However, it doesn’t recognise Conf...

Using LINQ to create an IEnumerable<> of delta values

I've got a list of timestamps (in ticks), and from this list I'd like to create another one that represents the delta time between entries. Let's just say, for example, that my master timetable looks like this: 10 20 30 50 60 70 What I want back is this: 10 10 20 10 10 What I'm trying to accomplish here is detect that #3 in the ...

how to sort a collection based on type in LINQ

Hi, I have a collection like this, Class Base{} Class A : Base {} Class B : Base {} List<Base> collection = new List<Base>(); collection.Add(new A()); collection.Add(new B()); collection.Add(new A()); collection.Add(new A()); collection.Add(new B()); Now I want to sort the collection based on type (A/B). How I can do this? Please he...

ordered swap on simple collection

I have a method that swaps two items: swap( collection['a'], collection['b'] ); // result = 'b', 'a' swap( collection[0], collection[1] ); // result = collection[1], collection[0] swap( 0, collection.indexOf(collection[1]) ); // result collection[1] index, 0 The swap method cannot be modified. Four possible values stored in a coll...

Hide/disable/remove/shootintheface office 2007 ribbon programmatically

We are embedding a word control inside of a winforms app, and need to hide and disable the ribbon on Office 2007 and 2010. Is it possible to hide/disable the office 2007/2010 ribbon programmatically using the office interop dlls? Is there another method available to do this? ...

Looking for a good WPF solution for a transparent, click-through overlay

I want to try something different, and am attempting to display an overlay on top of my current WPF GUI that allows the user to still interact with the GUI, but provides a layer of annoyance to let them know that something's up. My question is really two separate questions: 1. How would you do the overlay? My first attempt was to use...

How can I add the installation of .NET 3.5 to Installer on Windows 2008 Server R2

I have a homemade bootstrapper (call it SetUp.exe) that checks whether .NET 3.5 is installed on the target machine, and, if not, launches the installation by running dotnetfx35.exe. Fine. This works for all cases that I need EXCEPT for Windows 2008 Server R2. On this OS, the .NET installer does not install/enable .NET 3.5. Instead it...

Record and save audio in c# .net web application

Is there anyway that I can record sound from a microphone using c# .net What is the best option if i have to save the audio online in terms of the file occupying storage space. Any particular format that the file should be saved in for optimum output. ...

Is there a rich text editor control that does both spell AND grammar checking?

I'm looking for a winforms or wpf control that can do both spelling and grammar checking in english and also do red & green squiggly underlines, similar to MS Word. So far, all I've been able to find are spell-checker controls. I'd be open to good spell checking and grammar checking libraries as well - if you can recommend an integrati...

RegistrationServices.RegisterAssembly error - help!

I have an assembly on a shared folder (UNC-path only, no mapped drive). When I try to register it programmatically via RegistrationServices, I'm getting a strange error. Here's the code: using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; namespace BLRegisterAssembly { public static class...

How to reduce the size of an image in C# and .NET 3.5?

I have a screen shot I take in my mobile app. The screen shot takes about 32 KB when saved as a png on a disk. I am sending these to a central SQL Server and 32 KB is too big for that amount of times I will need to store that screen shot (approx 2500 times a day). Is there any kind of trickery that I can do to get it to save smaller? ...