.net

AppDomain.CurrentDomain.UnhandledException not firing without debugging

Hi, I have a .NET program with an event handler bound to Application.CurrentDomain.UnhandledException. When running the program with debugging, this event fires when an unhandled exception is thrown. However, when running without debugging, the event does not fire. What is my problem? Thanks, Andrew ...

Add property-level attributes dynamically using TypeDescriptor for PropertyGrid

Hi All, I want to add attributes (like Browsable(false)) dynamically while displaying in the grid. Scenario is that I have a custom class with some public properties. However, I dont want all of the public properties to be displayed in the UI. Is there a way out? I tried using TypeDescriptor. However, it works only at the type level an...

Derived DataGridView drawing problem. Shows black regions

Late Edit I tagged this as a C# question as well as C++ because the problem presents itself in both languages, and solution if shown would most likely be in the C# (the majority of the market). I have been developing an application under .net 2.0 (C++ to be specific, but irrelevant). This application uses a custom derived datagridview...

Can a custom attribute imply other attributes without inheritance?

I'm writing some library code, and classes that use that code are required to have two attributes specified (one custom attribute and one from .NET). It's a bit of a hassle to document this requirement and copy-and-paste both of those attributes onto every class that uses my library, so I thought it might be better to have my custom att...

Building which properties to select with LINQ To Object

I am trying to build a LINQ query at runtime so that only certain properties are selected. I have thought of something along the lines of being able to build a query by appending additional .Select() calls to my query or using the dynamic LINQ extensions to pass a string of columns (would like to stay away from a string built query). H...

How to get the selected index of MVVM-bound radiobuttons?

I have an ItemsControl which is bound and set to an observablecollection in my viewmodel: <ItemsControl ItemsSource="{Binding AwaySelection}" > <ItemsControl.ItemTemplate> <DataTemplate> <RadioButton Content="{Binding AwayText}" ></RadioButton> </DataTemplate> <...

Why is WebClient (System.Net) getting from URL twice?

I've got a method like this: private string getFromURL(string url) { WebClient myClient = new WebClient(); return myClient.DownloadString(url); } using WebClient from System.Net. It appears to be hitting the url twice (I'm also watching the log of the web server in question and it records two hits). Any idea why this might b...

How can I draw a custom ComboBox inside a DataGridViewCell?

I have a custom ComboBox control that I want to use in a DataGridView. I first inherited DataGridViewCell and am trying to achieve my goals overriding the Paint() method. The problem is that after inheriting DataGridViewColum and setting the CellTemplate property to a new instance of my CustomDataGridViewCell class, the cell is grey with...

Flex Populating Tree Control From .NET DataSet

Am currently working on a Tree control, and being my first time to delve into this, I need your inputs and advice. My tree control is retrieving data from a .NET web service. My .NET webservice returns a string which is parsed from a dataset via the command DataSet.GetXML method. Function MyFunc() as String 'Populate the dataset her...

Needed: MM7 server for .Net

I'm looking for MM7 server that can be used within a .Net program, on windows server 2008 environment. What I found so far: InetLab MM7.Net - not very stable on Win2008, but OK, ActiveXperts SMS and MMS Toolkit 5.2 - only SMS server, no MM7 server. Any other ideas? ...

C++ .NET convert System::String to std::string

How do you convert System::String to std::string in C++ .NET? ...

How can I stop OverflowException being thrown on integer division?

Hello World! I am getting OverflowException's thrown at me when I don't want them (or so I think). I am performing some odd calculations where I expect the values to overflow, discarding overflowed bits. It seems I can't get this to work properly though. Basically this is one pair of i and j which happens as I iterate over huge sets (i...

Searching Graphics Device Context For Pixels of Specific Color

I'm working on writing some automation code and I'm running into a problem finding an efficient way to examine the pixels that presently exist on the display. I've familiarized myself with the GetPixel function that exists in the gdi32 library, but it's too slow (in fact it takes about 10 seconds just to scan a line of about 1900 pixel...

MD5 hash with salt for keeping password in DB in C#

Could you please advise me some easy algorithm for hashing user password by MD5, but with salt for increasing reliability. Now I have this one: private static string GenerateHash(string value) { var data = System.Text.Encoding.ASCII.GetBytes(value); data = System.Security.Cryptography.MD5.Create().ComputeHash(data); return ...

Map pointers to immutable objects with Hashtable in .NET

I have a Hashtable object which "names" or "map" various fields in a class with a string ref class Interrupt{ Interrupt(){ this->type = 0; this->size = 0; } int type; int size; } Interrupt^ interrupt = gcnew Interrupt(); Hashtable^ map = gcnew Hashtable(); map->Add("InterruptType", interrupt->type); map->Add("Interrup...

What is the equivalent of a Java applet in .NET?

What is the equivalent of a Java applet in .NET? Is it Silverlight? Is Java applet still widely in use? ...

Using ThreadExceptionEventHandler: determine which thread caused the exception

Using the Application.ThreadExceptionEventHandler, is it possible to determine which thread caused the exception (the thread id)? The same question applies to using the AppDomain.UnhandledExceptionEventHandler to catch non-UI thread exceptions. If the answer is no, is there any other way to determine which thread raised the unhandled e...

Class generation from database schema

I've dug around through previously asked questions and have had no luck finding a duplicate. I would love to generate basic entity classes in .Net from a DB2 schema (using the iSeries OLEDB provider). Is there any simple way to do this? I've looked into MyGeneration and CodeSmith and it just seems like there must be an easier way. ...

What is the purpose of Array.GetLowerBound(int) ?

I don't understand the purpose of Array.GetLowerBound(). Does it ever return non-zero? When? How? Thanks. ...

Why do AppDomain exceptions invariably terminate the application?

This is related to a previous question. What I'm trying to understand now is how come UI thread exceptions can be prevented from terminating the application while non-UI exceptions can't be. For reference, see this example. Most importantly, what I would like to be able to do in that case is "silently" terminate the process - without ...