.net

How to get line number(s) in the StackTrace of an exception thrown in .NET to show up

MSDN says this about the StackTrace property of the Exception class: The StackTrace property holds a stack trace, which you can use to determine where in the code the error occurred. StackTrace lists all the called methods that preceded the exception and the line numbers in the source where the calls were made. So I kno...

identify whether a GUI event was fired directly by the user or because of a code assignment in .Net

Suppose you are using a control such as NumericUpDown which has the value property. and you set the value numericUpDown1.Value = 10; then the .net will fire the event numericaUpDown1ValueChanged(sender, args), also the user can directly set the value of this control and the .Net will fire the same event with the same sender. to be able ...

Why do we so many kinds of assembly loading methods?

Hi, AFAIK, there're 3 methods to load an assembly into a AppDomain: Assembly.Load() Assembly.LoadFrom() Assembly.LoadFile() The LoadFrom() method takes the assembly filepath as its argument, but the filepath is merely providing the assembly identity information as a clue to the CLR. The LoadFrom() method still internally calls Load(...

Linq query on Dictionary<int, double> type

I have a dictionary of type Dictionary<int, double> and want to eliminate values equal to a certain value. At the moment I have Dictionary <int, double> dict = GetDictionary(); dict = dict.Where(x => x.Value != 100).Select(x => x); And am getting the error: Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<Syste...

Using Dependency Injection with Http Handlers

I am using ASP.NET MVC 2 with Ninject, and Linq2SQL behind a repository pattern, based on Rob Conery's TekPub Starter Site. With controllers it all works fine, however I have an HTTP Handler (it serves and resizes images from a DB), and I have no idea how I use Ninject to replace my ISession interface with a concrete instance of my Linq...

VSIX: Getting DTE object

My Visual Studio package requires the use of an EnvDTE.DTE variable, but it always gets back as null. After reading up on many hacks, all of them say to use the OnShellPropertyChange() method (IVsShellPropertyEvents), but sometimes it just never fires - as if my extension never finishes loading. I'm using VS2010 and checking against bot...

Big vs Small Open Source Project, which is more useful to learn from?

I'm looking to help out in some open source projects, to learn from better developers, as well as add to my resume in areas where I'm lacking. I had a look through codePlex and I can see some quite popular projects, were I'd probably get to do very little, but look useful to the community, and some small projects which I think I could c...

How to set color for a font class- object in VB.NET..?

How to set color for a font class- object in VB.NET..? i mean.. Dim MYfONT As New Font("Microsoft Sans Serif", 16, FontStyle.Bold) e.Graphics.DrawString(TabMain.TabPages(e.Index).Text, MYfONT, SystemBrushes.HighlightText, paddedBounds) how can i set this font class object(MYfONT) - color to Black. ? ...

What exactly is meant by Platform? How many versions of CLR & JVM are available?

Does platform mean the OS or the CLR,JVM & like that?? I heard that CLR & JVM differs from OS to OS.. So what different versions of JVM & also of CLR is availabe right now in market? (I think CLR is having only 1 version that is for windows only) pls clarify my this confusion as much as possible... ...

Is there a automation framework for gtk# applications?

Is there a automation framework for gtk# applications like white or NUnitForms? ...

Can I call C#, or C++, from html pages for server-side scripting/programming on localhost?

I am running Aprelium Abyss Web Server from my home computer and I have a plain old normal website. You know how you can have separate PHP files, and then call the functions inside of then within the HTML page using the onclick="" of a button? Well, I have a C# and C++ program on my computer (where the server is located), and would lik...

Confine A Custom Thread to a Class instead of other classes

using System; using System.Text; using System.Threading; namespace Functionality_Threading { class Program { static void Main(string[] args) { TestA testFunction = new TestA(); testFunction.EventHandle += new TestA.EventHandlerMain(testFunction_EventHandle); var newThread = new...

Watching value types on the stack and objects on heap from within an application

Forgive me If this is a dumb question. Can one programmatically "observe" the contents of stack and heap while an application (say a console app) is running? Are there any APIs which would do this? ...

LINQ to SQL - Left Outer Join with multiple INNER JOINS

I am using multiple joins in a statement and Have tried to make linq-to-SQl query for this but no success. SELECT ur.UserName, ur.LandmarkRef, lt.Date, l.Place FROM tbl_Users ur LEFT OUTER JOIN tbl_LandMarks l ON ur.LandmarkRef = l.LandMarkID INNER JOIN tbl_LandmarkTypes lt ON l.LandmarkTypeRef equals lt.LandmarkTypeID ...

Why is Socket.BeginReceive losing packets from UDP?

The following code waits for data over UDP. I have a test function that sends 1000 packets (datagrams?) of 500 bytes each. Each time I run the test function, the receiver gets only the first few dozen packets but drops the rest. I looked at the incoming network data using Wireshark and I see all 1000 packets are actually received, but ju...

DataGridView Row select without RowHeaders

How do you select the whole DataGridView row on cell select and disabling the selection of a single cell NOTE: just like the behavior of a listview ...

Tools and technologies for a highly secure web application

We're planning to build a web application that needs to be highly secure because a lot of money and reputation is at risk. Therefore I'm looking for tools and technologies that help in that endeavor. The tools and technologies should help prevent things like SQL injection, cross-site scripting vulnerabilities, remote code execution etc. ...

How to choose between one big method with passive overloads and a bunch of small overloads, each one doing a small amount of work?

Hi, There are two ways to implement overloads. The first one is to do everything in one method/constructor and call it from other overloads, which leads to longer method bodies. The second one is to do the minimum in each overload, thus having a code sometimes difficult to navigate and to understand which overload does what. For exampl...

Is there any difference between system.web.datavisualization and system.web.UI.datavisualization

Hello, I've found a nice article on how to create Chart progammaticaly in ASP.NET MVC on ASP.NET website. Scott Mitchell, the author, uses a class called Chart() that he said comes from system.web.UI.datavisualization. But, when I try to reference system.web.UI.datavisualization namespafe from my projet,looking at the .NET tab, I don't ...

how to divide console screen in four parts and each part work separately using C#

I want to divide my console screen in four part and each part work separately, I think in this we use thread but I am not getting how to use? ...