.net

How to avoid beep sound of DateTimePicker

I've got a custom extension of the WinForms DateTimePicker and it works fine, except for the fact that it gives this anoying beep sound whenever I press the escape or enter key. I tried overriding OnKeyPress like described here, but this way it blocks all of the pressed keys and thus makes it impossible to enter a date or a time using t...

Adding custom options in bound dropdown in asp.net

I have a bound dropdown list populated with a table of names through a select, and databinding. it shoots selectedindexchanged that (through a postback) updates a certain gridview. What happens is, since it runs from changing the index, the one that always comes selected (alexander) can only me chosen if you choose another one, then cho...

Validation (with custom ErrorTemplate) for a DataTemplate

I can't figure this guy out / in desperate need of assistance. I have an ItemsControl and a DataTemplate as the ItemTemplate i.e. <DataTemplate> <StackPanel> <TextBox Text={Binding Prop1}/> <TextBox Text={Binding Prop2}/> </StackPanel> </DataTemplate> I have seen plenty of examples for applying validation to th...

Should I use IDisposable for purely managed resources?

Here is the scenario: I have an object called a Transaction that needs to make sure that only one entity has permission to edit it at any given time. In order to facilitate a long-lived lock, I have the class generating a token object that can be used to make the edits. You would use it like this: var transaction = new Transaction();...

C# regex to validate "realistic" IP values

Regex that somewhat validates if a value has one of the following characteristics: 123-29-123-123.subdomain.zomg.com:8085 123.12.34.56:420 Unfortunately, I'm terrible at Regex, C#, google searches, and the differences between proper nouns and regular ones. It can be a lose approximation, in fact I would go with anything that has a : ...

How to disable listbox auto select item when pressing key

I have a listbox where I want to copy and paste items within that listbox. Copy and paste works fine but everytime I press "Crtl + C" the item starting with the letter C is automatically selected. Can this automatic selection be disabled or am I missing something here Here is the copy and paste method I implemented: private void li...

LinkButton not firing OnClick event in Accordion

I have not been able to get the break point I have on LinkButtonDelete_Click to fire. Is there a trick to dealing with buttons inside of AJAX Accordions? Thank you. <cc1:Accordion ID="Accordion1" runat="server" DataSourceID="ObjectDataSource1" SelectedIndex="-1" RequireOpenedPane="false"> <HeaderTemplate> <asp:Label ID...

Which version of .NET is available for Xbox 360?

I tried to look this up on MSDN, but couldn't get a straight answer. It says: The .NET Compact Framework for Xbox 360 implements a subset of the .NET Compact Framework, and has been optimized to take advantage of and expose the power of the Xbox 360. What exactly is the subset? Which version of the framework? 3.5? 2.0? ...

Why can't I expose an interface in a .NET asmx web service?

I have a .NET web service (using asmx...have not upgraded to WCF yet) that exposes the following: public class WidgetVersion1 : IWidget {} public class WidgetVersion2 : IWidget {} When I attempt to bind to the web service, I get the following serialization error: Cannot serialize member WidgetVersion1 of type IWidget because it is an...

.Net Custom Components "disappear" after file save

I might have a hard time explaining this because I am at a total loss for what is happening so I am just looking for some guidance. I might be a bit wordy because I don't know exactly what is the relevant information. I am developing a GUI for a project that I am working on in using .Net (C#) Part of the interface mimics, exactly, wha...

Single Sign on- From our customer's Active Directory

We have an ASP.NET MVC website that a customer is requesting Active Directory single sign on. My thought is that we will need something behind their firewall in order to send encrypted credentials or a user's ID over to our server... any best practices or products that do this would be extremely helpful! Edit: We are trying to make th...

Accessing Extension Objects

I've added an object to the XsltArgumentList. I was wondering how I could access and display it in my transformation? xslarg.AddExtensionObject("someKey", "someValue"); However, when I transform, I wan't to be able to display "someValue". Any idea how? Thanks. ...

Launching my deployed my app gets "has stopped working" error. How do I debug this?

I deployed a VB.Net app and ran it and I get 'AppName has stopped working" "Windows is checking for a solution to the problem" along with a Cancel button under Windows 7. Under XP I am only getting the option to Send the error report to Microsoft or not. There is no apparent way to hook into a debugger. I am not getting any exception da...

How to use unlinked result of linq?

Hello, for example I'm trying to get the data from database like: using (ExplorerDataContext context = new ExplorerDataContext()) { ObjectQuery<Store> stores = context.Store; ObjectQuery<ProductPrice> productPrice = context.ProductPrice; ObjectQuery<Product> products = context.Product; ...

mono --aot with MinGW: unknown pseudo-op: `.local'

Can I user mono's AOT feature to natively "pre-compile" .NET DLLs (and or EXEs) to make them harder to reverse engineer? If so, how do I get mono/AOT working in Windows 7? (I'm running x64 but the app is targeting x86 explicitly.) I just installed Mono 2.6.3 and MinGW 5.1.6 and I'm trying to AOT compile an exe (or a dll, it doesn't matt...

Determine Host or IP from domain user

Is there any way, on a windows domain, to get hostname or IP address given the domain username? C# APIs would be great. example: string GetUserIP(string username); ...

C#: Can you detect whether or not the current execution context is within `lock (this)`?

If I have an object that I would like to force to be accessed from within a lock, like so: var obj = new MyObject(); lock (obj) { obj.Date = DateTime.Now; obj.Name = "My Name"; } Is it possible, from within the AddOne and RemoveOne functions to detect whether the current execution context is within a lock? Something like: M...

An existing connection was forcibly closed by the remote host

I am working with a commercial application which is throwing a SocketException with the message, An existing connection was forcibly closed by the remote host This happens with a socket connection between client and server. The connection is alive and well, and heaps of data is being transferred, but it then becomes disconnected out of...

Java DnD - Java Component to .Net Component

I'm trying to use Java drag and drop to drag an object from a JTree into a native .NET component that is embedded in my app. This .NET component only accepts File objects, so I'm having trouble with the DnD's Transferable object. Anyone know how I can make this Transferable "look" like a file to this .Net component? p.s. I need this ...

Making your own "int" or "string" class

I disassembled the .NET 'System' DLL and looked at the source code for the variable classes (string, int, byte, etc.) to see if I could figure out how to make a class that could take on a value. I noticed that the "Int32" class inherits the following: IComparable, IFormattable, IConvertible, IComparable, IEquatable. The String and Int32...