.net

How do I catch an exception in a GUI thread?

An exception is thrown in a user control based on a picture box, causing it to show the typical error image (red X). Since the GUI thread caught and handled the exception itself, I cannot easily find out where the exception occurred and debug. I'm currently wrapping the whole OnPaint code in a try-catch, and was able to debug the code, ...

Getting the FileName from Open(Save)FileDialogs In C# Using Hooks

Please keep in mind that is is my first post. Summary In a program, I need to be able to retrieve the FileName associated with a FileDialog by intercepting Windows messages without access to the dialog object creating the dialog. Background I have an unusual problem concerning dialogs in .NET 3.0 with C#. Currently, I am working on ...

Quartz.net - Trigger not firing when scheduler runs inside a Windows Service

I've got a class library (c#, .net 4.0) implementing a wrapper class for a Quartz.net Scheduler and a bunch of Triggers and Jobs which I'd like to have executed. This wrapper class has a simple Start() and Stop() mathod to start or shutdown the Scheduler. When I instanciate my wrapper from a console application, it registers my Jobs + ...

Ajax Enabled WCF service not responding with data

Hi All, I have a very simple Ajax enabled WCF service that should return a single Entity of type EntityObject serialized to JSON. Here is my .svc file: [ServiceContract(Namespace = "FASServices")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class FASService { [Operati...

.NET WebServices Connectivity issue

I'm currently working on a piece of software designed in WPF that connects to a set of WebServices. The WebServices are defined in the app.config:endpoint of my application: <endpoint address="http://localhost:52870/WebServices/Service.svc" behaviorConfiguration="VanguardWebServiceBehavior" binding="wsHttpBinding" bindingConfigurat...

What is difference between unsafe code and unmanaged code in C#?

What is difference between unsafe code and unmanaged code in C#? ...

Add dynamic dotnet webcontrol into attribute value of static html

Hi, Easy one to explain. Is there any way I can do this: <div id="header" style='<asp:Literal runat="server" ID="litBackgroundImage"></asp:Literal>' > It looks valid, but Visual Studio will not recognise litBackgroundImage as a valid control in the code-behind. Setting the div as runat="server" won't work either because the style pro...

Convert AttributeReference to DBText

How can I loop through the AttributeReferences for a BlockReference and create an exact copy (looks the same to AutoCAD user) of the AttributeReference as a DBText entity. I've seen the code to do this in AutoLisp from the express tools burst.lsp, but I haven't been able to figure out how to translate it to .Net. Here is the simple cod...

implicitly and explicitly conversion of one reference type to another reference type??

implicit and explicit conversion of one reference type to other reference type?? please take an example to make answer more effective. ...

what is the use of delegates in C#?

Possible Duplicate: When would you use delegates in C#? On what condition should we use delegates ...

How to access ListView subitem by Key?

I am trying to access data from list view using columnheader name but I get errors LVProduct.FocusedItem.SubItems("Name").Text So, how do you use the function with string parameters? I don't want to use index it is too confusing ...

How can I pass a runtime parameter to a previously registered factory method using castle windsor?

I have a reporting MVC application that uses Castle Windsor. On application start up (in global.asax) all of the types are registered and then each subsequent request to the application resolves the relevant report type and windsor automatically handles the dependencies. I need to switch one of the dependant types for another depending...

Access OpenPDFFromMem function of an ActiveX control in .NET

I have an ActiveX control which has a function for opening a document directly from memory. The function has the following signature: Public Overridable Function OpenPDFFromMem(ByVal lpPDFData As Integer, ByVal nPDFDataLen As Integer, ByVal lpszUserPwd As String, ByVal lpszOwnerPwd As String) As Boolean How do I load the document in me...

insert value in datatable and pass it into a mehod

i just use this code to insert value in datatable and pass this table in method look code--- public class RoomBO { DataTable dt; RoomDal objRoom = new RoomDal(); public int insert(int room,string bedType, int bed, int charge) { //adds the details of the new room dt = new DataTable(); dt.Columns...

Add condition to linq query

I'm building a repository layer for nhibernate, in which I have the following find method: public IList<TEntity> Find(Expression<Func<TEntity, bool>> query) I would like to add a condition to the query in that method. The extra condition should limit rows to all where RemovedAt is larger than DateTime.Now. Explanation using SQL: Le...

How to dynamically subscribe to an event?

RELATED Watch control to determine events being fired? I need to detect when an event is fired. To do so I am trying to subscribe dynamically on the event. The problem is that I have different types of delegates, not all events have the same signature. The solutions provided in here and here expects object sender, EventArgs e, whi...

Is it possible to understand whether a certificate in Windows cert store imported as "Enable Strong Private Key" protection?

Is it possible to understand whether a certificate in Windows cert store imported as "Enable Strong Private Key" protection in .NET? ...

Extract information from flv file using C#

Is there a code help to extract head information and target frames from flv file using C#? ...

SQL Exception on immediate reconnect

I have a winform app that uses LinqToSql as it's DAL. There is a Central SQL DB and each laptop has a local SQLExpress DB. A seperate module, using Merge Replication, keeps the two in sync. When connection is lost to the central DB it 'fails over' to the local. This works great. However, when I regain conection to the central db, if...

Does WebBrowser's DocumentCompleted occurs on the same thread as the one that calls Navigate?

I'm almost sure it does but I just need to make sure. I don't want my app to be executing another method at the same time DocumentCompleted is being called. ...