.net

POS For .NET: Failed to set property properties of PosPrinter.

I can't set properties of PosPritnter class. For example PageModeStation, PageModeVerticalPosition, PageModePrintArea etc. PosPrinter posPrinter = (PosPrinter)posExplorer.CreateInstance(posPrinterInfo); posPrinter.Open(); posPrinter.Claim(1000); posPrinter.DeviceEnabled = true; posPrinter.PageModeVerticalPosition = 10; //<--- Exception ...

Convert Visual Studio 2003 forms to Visual Studio 2005/2008 forms using partial classes and Designer files

After migrating my Visual Studio 2003 projects to VS2005 (or VS2008) my forms would still be inside a single file. New forms on VS2005 and VS2008 are created using partial classes where all code generated by the editor is kept in the Designer.cs file. Since the VS2005 form creates is a much better way of dealing with forms, I would lik...

How to make sgen.exe keep the version of the assembly?

I want to create a serialization assembly for my assembly. sgen does it fine, but I can't figure out how to get it to assign the serialization assembly the same version as the source assembly. Any ideas? ...

Reuse a HttpWebRequest?

Am i able to use a HttpWebRequest? It seems like the 3rd request to a site causes a operation timed out and it seems like each creates a new connection so i want to know if i can reuse a HttpWebRequest by changing the url and getting the request again. Code in question is below and this code is to check if a range of urls exist. st...

How can I prevent a third party library from displaying a MessageBox?

I am integrating a third party C-based SDK into my .NET application. The application will run as a Windows service on a server, so it should not interact with the user in any way. Unfortunately, in certain error conditions it insists on calling MessageBoxA, presumably to report that something bad has happened. When this happens, the s...

Scrolling horizontally and vertically ListView WinForms C#

Hello, I've couple of questions regarding scrolling ListView without using external ListView controls from other vendors (free or pay versions). How to make 2 (or more) ListView bound together in the way that if i start scrolling one ListView the other one does exactly the same? Is it even possible to do with native 3.5 or 4.0 (when i...

CheckboxList input Not working in IE7/6

I modified asp.net checkboxlist using css. It hides input using display:none and I'm able to click on label and casue postback in Firefox but in IE when i click label in checkbox list it doesn't work. What could be wrong here? My code: <div style="padding-left:15px;"> <asp:CheckBoxList ID="cbl" runat="server" AutoPostBack="true" ...

C#.NET: Enter key to check CheckBoxes..

I want to use Enter key instead of Space key to check the checkboxes.. private void Form2_KeyDown(object sender, KeyEventArgs e) { CheckBox c1 = this.ActiveControl as CheckBox; if (e.KeyData == Keys.Enter && this.ActiveControl.Equals(c1)) c1.Checked = true; } I could do it if i w...

Singleton and HttpApplicationState

In a web app, I need to have only one instance of a class called ProcessManager. One way is to make it a singleton. The other way is to use the HttpApplicationState to make sure I always access the same instance, like this: public static ProcessManager ProcessManager { get { HttpApplica...

Adding performance counters to existing category

I think this is more of a perfmon glitch, actually. Here's what's going on: 1. I create a counter category, and add some counters to it. They work fine. 2. I decide that I need some extra counters in that category. 3. I delete that counter category, and re-create it with new counters added. At this point, all old counters are working, b...

Thread Abort in .NET

I have a thread thats analyzing a file and making transactional calls to the database, each transaction has a audit entry as part of its transaction. Is there anything vastly wrong with calling Thread.Abort() to stop the processing of the file? Rather than scatter ugly safe spots everywhere? The file will be closed after the Abort call...

WPF Expander IsExpanded binding

I have an expander control with it's IsExpanded property bound to a bool in the mvvm model. The binding works fine until you dont touch the expander. Once you click the arrow in the expander to expand, the binding stops working. Setting the bool ShowPreview to false in the model doesn't collapse the expander. <Expander Name="pExpander"...

"Access to the system path is denied" when using 'System.IO.Directory.Delete'

I'm using System.IO.Directory.Delete and trying to delete system folders such as 'My Music', 'My Videos' etc, but I get errors similar to "Access to the system path 'C:\users\jbloggs\Saved Games' is denied". I can however delete these folders via Explorer without any problems, I have full permissions to these folders. Any suggestions o...

comparing to MinValue using <= instead of ==

I just ran across the following line of code: if(someInt <= int.MinValue) { /* ... */ } I'm wondering if I'm missing some subtlety that makes using the <= comparison better than the more intuitive == comparison? ...

How to publish to Facebook fan/business pages (not user profiles)

I'm trying to figure out if fan/business pages are conceptually similar to regular user pages. My end goal is to publish events from a third-party Web site (new content, announcements, etc.) into the FB page that promotes the third-party site. I'm not sure where to start exactly. Been looking at the .NET Facebook SDK, and it seems focus...

How do you write a consistent UI Automation for MS? MSAA & UI Automation don't seem to overlap.

Working on a general Automation tool, considering moving from Win32 Message hooks to .net UI Automation, however the feature set of UI Automation doesn't cover all we have in Win32 and still doesn't seem to support all the GUI on Windows. One such example is Windows Live Messenger. Windows Live messenger 2009 is still using the older D...

regex: negative lookbehind in negation character class? (.NET flavour)

What I'm trying to do: remove innermost unescaped square brackets surrounding a specific, unescaped character (\ is escape) input: [\[x\]]\]\[[\[y\]] output when looking for brackets around y: [\[x\]]\]\[\[y\] output when looking for brackets around x: \[x\]\]\[[\[y\]] In short, remove only the unescaped set of brackets around the spec...

How to get just the URL of an Action in an ASP.NET MVC View?

I want to get the URL of a route using the same syntax as Html.ActionLink, but don't know how to do that from my View. Is there an HtmlHelper extension that works like ActionLink but returns only the URL? For instance, I want to write: <img src="<%= Html.ActionUrl("Image", new { id = 42 }) %>" /> ...

Castle components dispose order

We have a number of castle windsor components declared in a config file. Some of the components somewhere deep inside might require the services of other components. The problem is when the application is being closed and the Container is being disposed. During Dispose()/Stop() of the Startable/Disposable component (A) when it requires...

How to change Crystal reports connection properties in code?

Back when Crystal Reports still supports ActiveX, we have crystal reports that were built to use ODBC data source point to an Access or SQL database. In run time, we would change the report to use OLE DB (ADO) instead of ODBC, change the server name, database name, username, password to ones specific to the user, and run the report, it w...