.net

System.ComponentModel.Win32Exception: The operation completed successfully

I am getting this exception sometimes while running my Windows Forms app for a long time: System.ComponentModel.Win32Exception: The operation completed successfully at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) at System.Drawing.BufferedGraphi...

Access WCF Authentication information from the Service Side

I use this code to authenticate to my WCF Service: proxy.ClientCredentials.UserName.UserName = "test"; proxy.ClientCredentials.UserName.Password = "pass"; Is there any way to access this information from within a method of my WCF Service code? (I'm not interested in the password used, more the username for audit purposes.) I'm trying...

Non-editable combobox in Winforms?

Is there a combobox dropdown style control in Winforms that doesn't let the user to type anything but only pick from the existing list of items? ...

C# Accessing field syntax

How would I access an object's variable's value if I only have the name of the variable I wish to access? In C#. Say I had a list of variable names represented as strings in an array. How would I access them in a loop, for example. I can do something like the following in Actionscript: var arrayOfVariableNames:Array = ["name", "age",...

OrderBy and OrderByDescending are stable?

I am currently reading Pro LINQ c# 2008, and in page 87 the guy says OrderBy and OrderByDescending are stable. But he says exactly the opposite in page 96. It looks to me as he is referring to exactly the same functions, so I don't get it. Are they stable or not? ...

URL with no query parameters - How to distinguish.

Env: .NET 1.1 I got into this situation. Where I need to give a URL that someone could redirect them to our page. When they redirect they also need to tell us, what message I need to display on the page. Initially I thought of something like this. http://example.com/a.aspx?reason=100 http://example.com/a.aspx?reason=101 ... http://ex...

What do you rename Form1 to?

This is pure curiosity... Most 'professionals' will likely never use "Form1" as a valid class name in their Windows Forms projects. I usually end up renaming it to MainForm. What do you do? Edit: For those of you that use hungarian notation (frmMain) - why? I don't think it would still be considered a standard practice... is it? ...

How can I return List<MyInterface> in this scenario

Let me start by saying I'm pretty new to using interfaces. I'm writing a method (GetClaimDetails) that will return information about a medical insurance claim. If it is claim type A, it will return an list of the ClaimDetailA class. If claim type B, return list of ClaimDetailB class. Both of these classes share common properties but eac...

Differences between .Net Hashtable, Java Hashtable & HashMap

Am I correct in saying that a .Net Hashtable is not synchronized while a Java Hashtable is? And at the same time a Java HashMap is not synchronized and has better performance? I am rewriting a Java app that makes heavy use of HashMaps in C# and I would like to use a HashTable and ensure that the performance is basically equivalent. ...

Best way to do ORM with Access DB as datasource

I've gone back and forth on this problem and can't seem to figure out the best way to do this. Here's the situation: Access database (3rd party product) with data I need in it, from a good number of tables (18 tables) Ideally, need to try to get records into strongly-typed objects somehow so I can query around with LINQ LINQ to SQL cl...

Uanble to connect to AS400

When I am trying to connect to AS400 using C#.NET, it's giving me error: IBMDA400 is not registered on local Machine Can anyone please explain me about this? ...

LaTeX for PDF generation in production

I used LaTeX for writing couple of white papers while I was in grad school. From that I have a really good impression about it in terms of what LaTeX allows user to do, especially the fine control it provides over formatting, etc. Now I am debating whether I should actually use LaTeX for our production apps to generate PDFs. I have tri...

generic.xaml not being re-packaged when modified.

What I have installed... Windows Vista Ultimate Service Pack 1 Visual Studio 2008 Service Pack 1 .Net Framework 3.5 Service Pack 1 Silverlight 3.0 My First Problem... I modify themes\generic.xaml and save the file and run the project and the changes I just made in themes\generic.xaml are not inside the assembly. I have used reflecto...

How to split a data layer and business object layer, what are the appropriate duties of each?

If there was a line of business application layered like this, would this be an appropriate division of labor : Data Access Invokes only stored procedures, maps properties of DTOs to a hash tablse which are used to populate ADO.NET command's parameter collections. Only assembly with reference to SqlDataClient. Significant logic dealin...

Correct way to develop a large application

We are developing a very large web application in .Net 3.5. Two separate vendors are involved having expertise in different areas. Both the vendors are located remotely and working on separate functional area of the same web application. I was wondering what is the best way to handle the development of UI. The UI have a master structure...

.NET stream capabilities - is the CanXXX test safe?

There is a fairly common pattern used in .NET to test for the capabilities of a class. Here I'll use the Stream class as an example, but the issue applies to all classes that use this pattern. The pattern is to supply a boolean property called CanXXX to indicate that capability XXX is available on the class. For example, the Stream cl...

ASP.NET MVC: Tabs ASCX - Adjust CSS class based on current page?

Hello, I have an ASP.NET MVC application and I'm trying to implement tabs which will navigate to different pages. The tabs are implemented as a simple ASCX usercontrol, e.g. <ul> <li><a href="xyz1.html>Number One</a></li> <li class="activePage"><a href="xyz2.html>Number Two</a></li> <li><a href="xyz1.html>Number Three</a><...

Names in the interop assembly have wrong capitalization

I have a VC++ COM component with a type library. The type library of this component declares an interface and a co-class: [ object, uuid( ActualUuidHere), dual, nonextensible, oleautomation, hidden, helpstring( ActualHelpStringHere ) ] interface IWorkflow : IDispatch { //irrelevant properties here } ...

Improving Catalog Management C#

There is a catalog management page where user enters color in comma seperated format in the form,and submits the entry with some basic product description and price detaisl etc. A new panel appears,which has a drop down that is populated with the colors entered in the above part of the screen,Now user can upload the images one by one for...

How to hide a property of custom collection while using DataGridView DataSource?

I have a custom collection let's say MyClass { prop Name; prop Address; prop isRequired; } MyCustomCollection : List<MyClass> { } When I do MyCustomCollection collection = new MyCustomCollection (); datagridView.DataSource = collection; The datagridview is populated with three columns Name, address , isRequired.. ...