.net

Does this Asynchronous Lambda Cryptica Code do what I think?

Action<SPItemEventProperties> deleteAction = DeleteWorkspace; AsyncCallback deleteDone = deleteAction.EndInvoke; SPSecurity.RunWithElevatedPrivileges(() => deleteAction.BeginInvoke(properties, deleteDone, null)); So this is suppose to call DeleteWorkspace Asynchronously and then call EndInvoke when its done, I wrote it but ...

VB9 New thread with multiple parameters

I'm trying to create a new thread and send multiple parameters as well as a delegate to report back. In VB8 I always hate to do this because it requires either introducing a new class/structure or a delegate. Is there any better way to do this in VB9 ? I'm looking for a solution something like this : Dim Th As New Thread(AddressO...

Copying large amounts of data into a SQL CE database

If I have a large amount of data in memory, what is the best way to copy it into a SQL CE table? The current technology stack is C#, ADO.net, and SQL CE. My initial idea was to do one INSERT statement for each row of data, but this is time-consuming. Is there an easier way? ...

WinForms: Foreground color of progress bar always green on XP Luna

The WinForms ProgressBar control allows its foreground color to be set. While this normally works fine, the foreground color setting seems to be ignored on XP when using the obnoxious Luna style: it is always green. Similaraly, XP Luna seems to ignore the 'Style': Although I have set it to 'Continuous', the progress bar is always drawn ...

How do I convert a System::String to a unsigned char * ?

I saw another post that suggested the following: String^ clistr = gcnew String("sample"); IntPtr p = Marshal::StringToHGlobalAnsi(clistr); char *pNewCharStr = static_cast<char*>(p.ToPointer()); Marshal::FreeHGlobal(p); I just wanted to check and see if there is any other, preferred way, or if anything was wrong with the above? ...

Differences between .NET 3.0 & 3.5?

What are the major differences between the .NET 3.0 & 3.5 frameworks? ...

How can I easily tell if two collections of .NET EntityObjects contain any of the same objects?

Pages have Roles. Users have Roles. A user may only view a page if he and it share one or more roles. This works: Dim Allow As Boolean = False CurrentPage.Roles.Load() For Each r As Role In CurrentPage.Roles r.Users.Load() For Each u As User In r.Users If u.Id = CurrentUser.Id Then Allow = True ...

Call Unmanaged code from managed or spawn process

I have an unmanaged C++ exe that I could call from inside my C# code directly (have the C++ code that I could make a lib) or via spawning a process and grabbing the data from the OutputStream. What are the advantages/disadvantages of the options? ...

Regular expression to validate valid time

Can someone help me build a regular expression to validate time? Valid values would be from 0:00 to 23:59. When the time is less than 10:00 it should also support one character numbers ie: these are valid values: 9:00 09:00 Thanks ...

Service not fully stopped after ServiceController.Stop()

ServiceController serviceController = new ServiceController(someService); serviceController.Stop(); serviceController.WaitForStopped(); DoSomething(); SomeService works on a sqlserver file. DoSomething() wants to copy that SQL file. If SomeService isn't closed fully it will throw an error because the database file is still locked. In t...

Need a .NET WinForms IP Address Control

I need a robust, user-friendly, professional-looking .NET WinForms IP address control for use in a project I'm working on. This control, at a minimum, should support IPv4 addressing and ideally would support IPv6 addressing as well. I would prefer a free control with C# source code, but don't mind paying for one. I am using .NET 3.5 S...

How to set propertygrid griditem tag

I've got a PropertyGrid that reflects properties of my class. I am watching the PropertyValueChanged event and notice that PropertyValueChangedEventArgs provides the GridItem that was changed. That GridItem has a Tag property that I can get. I don't see how to set the Tag property of a GridItem to a value. How can I set the Tag proper...

Is SQLite.Net thread-safe?

I'm asking about the .Net implementation - System.Data.SQLite. Are there guidelines to using it in a thread-safe manner? I know SQLite itself can be compiled with or without thread safety - but how was System.Data.SQLite compiled? ...

Specify client certificates in HttpWebRequest in .NET Compact Framework 2.0

I'm trying to specify a client SSL certificate using an HttpWebRequest. In the full framework version of my application I am able to simply use the ClietnCertificates collection property to add my client certs. Unfortunately, this property does not exist on the compact framework. Are there any other ways I could accomplish this? Mayb...

Using AssemblyBuilder, how can I make all or any of the referenced assemblies embedded instead of linked in the saved assembly?

I have an executing assembly, which generates another assembly dynamically using AssemblyBuilder. The generated assembly consists of functions which simply test the construction of certain classes in the executing assembly. Since the functions in the generated assembly reference classes in the executing assembly, I want to have the exe...

Image Library Software

Hi guys I have a need for an Image Library within my organization and I was wondering if anyone knows of any that they could recommend. It will need to be able to integrate with any number of our own solutions (meaning it will have a set of services or APIs that one can use for integration). Also I would be great if it had: facial reco...

Perform .Select() on IQueryable with List of Func<T, string> delegates.

First of all, let me apologize in case the title doesn't make sense. I'm having a hard time understanding what I'm doing, let alone being able to use the right words for describing what I'm doing. I'm building a generic grid class in which I define the columns by a header / linq expression combination: public class Column<T> { publ...

How do I cast a list of an object to a list of an interface that the object implements in VB.net?

I am working in VB.net and have a Class, Foo, that implements an interface, IBar. I have a List of Foo's, but I need to pass a list of IBar's into a function, but I keep getting casting errors, even when I use DirectCast. My code is Class Foo Implements IBar End Class Interface IBar End Interface Sub DoIt(ByVal l As List(Of IBar...

Custom Drawing based on data values for a row in a DevExpress PivotGridControl 9.1

I am trying to do some custom drawing in the row headers in a PivotGridControl in version 9.1. In version 8.2 I could use CreateDrillDownDataSource on the FieldCellViewInfo property on the event for the custom draw. In 9.1 this method does not exist. The code I was using in 8.2 looks like this. Called from the CustomDrawFieldValue e...

MSBuild fails, but building inside Visual Studio works fine

C#, .NET 2.0 I have an ASP.NET website in a solution, with 2 other projects (used as library references). When I build (debug or release) in Visual Studio, everything works fine. However, building with MSBuild fails. This build had been working (it's actually invoked via a nAnt task). The only thing that has changed is that I have a...