.net

SGEN, InternalsVisibleTo and assembly signing

Hi, I'm trying to do something a bit unusual... I have this class Foo : public class Foo { public Foo(string name) { this.Name = name; } internal Foo() { } public string Name { get; internal set; } public int Age { get; set; } } Notice the internal setter for Name, and the internal default c...

Complex Reflection Scenario

Hi, I need some help trying to come up with a way to set this line of code using reflection: this.extensionCache.properties[attribute] = new ExtensionCacheValue((object[]) value); this.extensionCache is a internal private Field in the base class im inheriting from. I can get at the extensionCache field with ...

Data Access Layer design patterns

Hello, I have to design a Data Access Layer with .NET that probably will use more than one database management system (Mysql and Sql Server) with the same relational design. Basically, it has to be simple to switch from one database to another so I would like you to recommend me some web-sites or books that has been useful for you, with...

Saving settings for "AllowUserToOrderColumns" of my DataGridView

Hello. Is there a way to make my program remember the way columns are re-ordered so when the application is re-opened, it orders them the same way as it was when I closed the form. I can't find any properties for this. Thanks. ...

How can I split (copy) a Stream in .NET?

Does anyone know where I can find a Stream splitter implementation? I'm looking to take a Stream, and obtain two separate streams that can be independently read and closed without impacting each other. These streams should each return the same binary data that the original stream would. No need to implement Position or Seek and such...

How to write to a (Bitmap?) image buffer for faster GDI+ displays?

Using C++ and .net I have a stream of data I want to display as a scrolling image. Each time I get some new data I want to add it as a new row (128x1 pixels) and scroll the previous contents to one side. My first stab at the problem involved rendering the entire data set each time I got a new row. This worked, but was far too slow, so I...

Installing a Windows Service with dependencies

Hi all, My installer program doesn't suppport installing services but I can run a program/command line etc so my question is how can I install a Windows Service and add 2 dependencies using the command line? The program is a .Net 2.0 app. Thanks ...

.net enumeration first and last

is there a way in .NET (or some sort of standard extension methods) to ask questions of an enumeration? For example is the current item the first or last item in the enumeration: string s = ""; foreach (var person in PeopleListEnumerator) { if (PeopleListEnumerator.IsFirstItem) s += "["; s += person.ToString(); if (!PeopleLis...

MVVM Design for Multi Document app?

I have an application which has a similar interface to Visual Studio, in that there's a list of documents that can be opened, edited an saved. Each document can be of different types and has different editors. I also have a general Save MenuItem. What I want to do is have the Save command only save the active document. Is there a stand...

WriteableBitmap unavailable?

I've discovered what may be the perfect answer to a question on buffered drawing, but for some reason my version of VS2008 doesn't seem to have a WriteableBitmap? I've tried including the relevent namespaces as per the documentation: using namespace System::Windows::Media; using namespace System::Windows::Media::Imaging; But that just...

How to use SQL user defined functions in .NET?

Hello I created a scalar function in the DB SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[fn_GetUserId_Username] ( @Username varchar(32) ) RETURNS int AS BEGIN DECLARE @UserId int SELECT @UserId = UserId FROM [User] WHERE Username = @Username RETURN @UserId END Now I want to ru...

Why is string.contains() returning false?

I have the following string: \\\?\hid#vid_04d8pid_003f#62edf110800000#{4d1e55b2-f16f-11cf-88cb-001111000030} stored in a string variable (from a function call) called devPathName and the following defined: const string myDevice = @"vid_04d8pid_003f"; but the following code always evaluates to false: Boolean test = true; test = devPa...

How do I determine when to show a tooltip?

I'm writing a calendar control in .Net WinForms that will show a tooltip for each date. What's the best way to determine when to show the tooltip? Showing it immediately in MouseMove would make it get in the way, so I'd like it to show when the mouse hovers over each date cell. The MouseHover event only fires on the first hover after ...

Storing SSN/CC data

I read through quite a few similar questions here on SO but none were in quite the same situation as I am. Previously, user enters in a ton of info including SSN, Spouse SSN, and CC data. When the user completed the process, the info was pushed on PDFs, zipped up (which then got encrypted), and then FTPed back into our server. We save...

Java AppDomain like abstraction?

I'm curious if there are any Java abstractions that are similar to .Net's AppDomain. In particular, I'm curious because I've found that with our Coldfusion/J2EE server we need to restart it every few days due to a slow memory leak that we haven't been able to easily track down yet. This can wreck our long-running processes and we'd rea...

Programmatically reading text from an image

hey guys My question is similar to this one 842986/how-to-read-text-written-on-a-image, except I'm looking for a way to do it programmatically. Essentially, does anyone know of a good, and simple, .NET compatible library, that is able to take in, say, a bitmap object or image object, and give me back any text on that image? cheers ...

MVVM opening new Workspace from Other Workspace (instead of Main ControlPanel)

Hi, I am learning MVVM using sample created by Josh Smith at http://msdn.microsoft.com/en-us/magazine/dd419663.aspx I wanted to add a functionality of update in the existing code, Like when user sees data on the Grid of 'All Customers' user can edit particular record by double clicking it, double click will open up new tab (same view/...

How to get Path previous to Exceuting Assembly

hi. i have some files located in c:\MyApp\file.txt and current executing assenbly in in debud filder c:\MyApp\bin\Debug\ i want to get address of above "file.txt" at run time.. i tried this Assembly.GetExecutingAssembly().Location it gives me c:\MyApp\bin\Debug\MyApp.exe how can i get address of "file.txt" ...

Application.Exit

Hello everyone, I am using VSTS 2008 + .Net 3.5 + C# to develop Windows Forms application. My confusion is, seems Application.Exit does not force application to terminate? If not, which method should I call to make application terminate? EDIT 1: Normally the main method is like this, how to exit Main function gracefully without callin...

Bluetooth in C#, Which stack, Which SDK?

We've got an application which needs to be able to use bluetooth for the following requirements: Receive files from bluetooth devices (up to 2 devices at the same time) Display all bluetooth devices in range Send files to bluetooth devices Scan for bluetooth devices and transfer files at the same time We're running on Windows XP. I'...