.net

Response 401 when using Credentials AND proxy (calling web service)

I using VB.NET 2.0. I am trying to call a web service. This web service requires authentication. So, I am able to execute the web service when using Credentials only. But, when I add a local proxy (I tried with ezProxy Manager) I get a 401 error. I need to get this working with a proxy as well. Any ideas why this may fail? ...

Unit testing asynchronous function

In the following code sample I have an Async Calculator class. This is injected with an ICalc, which will be a syncronous calculator. I use dependency injecting and mock the ICalc because this resembles my true scenario, though I guess the mocking isn't really of relevance to the question. The AsyncCalc has a function which will call ano...

Algorithm for creating unique bingo faces

Hi, Does anyone know of an algorithm that can generate unique bingo card faces? I'm looking to implement this algorithm in C#. Thanks, ...

Modifying config sections in App.config either at runtime or install time.

I have an WinForms application that is deployed using Visual Studio 2008's publish (ClickOnce) system. Within the application's app.config file I have a config section that is required by a third party component that has the form: <section name="thirdPartySection" type="System.Configuration.NameValueSectionHandler" /> The section is t...

C# 2 controls, both need to catch diffrent keypresses, even while one has no focus.

Hey, I'm trying to make some sort of intellisense look a like for an editor I'm working on. When the user types in the richtextbox and the letters match a word a listview will pop-up and the matched word will be selected. the problem is the focus is still on the richtextbox so all the key presses will go to that control, which is good...

tfs branch merged back to trunk. vbproj file name got changed

i merged a branch from an existing trunk and looks like all the new files in the branch came to this existing turnk as one project. Only problem is i said "copy from source" for the vbproj file and now it has the name of the file in branch. can i just rename this file and everythign will be back to normal or is ther esome more stuff invo...

Clever Uses of .Net 2 Iterators

C# 2 and VB.Net 8 introduced a new feature called iterators, which were designed to make it easier to return enumerables and enumerators. However, iterators are actually a limited form of coroutines, and can be used to do many useful things that have nothing to do with collections of objects. What non-standard uses of iterators have yo...

What would be the best approach is my application had to pull information from a website every day at 2am.

I'm making a small application that is supposed to download info from the web every day at 2am. It will download the information and write the strings to an XML file of my choosing. Using .NET and C#. My initial approach was to install a service on the users computer and have that run, but I'm not so sure. I've not even used it so much...

Is PostSharp a good way to profile code running in production?

I would like to run profiling code against some services running in testing and production. My plan is to use PostSharp to implement a class that looks like public class TimerAttribute : OnMethodBoundaryAspect { //some data members //... public override void OnEntry(MethodExecutionEventArgs eventArgs) ...

Can you make CustomValidator's ErrorMessage show up in a TextBox?

I have the following code: <asp:TextBox runat="server" ID="textBox1" /> <asp:CustomValidator ID="validator1" runat="server" ErrorMessage="error message" OnServerValidate="thing_to_validate" Display="Dynamic"></asp:CustomValidator> This allows the error message to show up BELOW the textbox when validating. My question is, how can I m...

POST file - not from client machine, from web/ftp server

I'm using .Net. Is it possible for a web form to upload an image from a web or FTP server? The files I need to submit are on the web. If this is possible, code snippet is appreciated. ...

In C# .NET 2.0, is there any way to get access to the URL history of a WebBrowser control?

Well, the title is pretty much the whole question. I'd like to be able to clear the WebBrowser controls history on every Navigate - to prevent my users from going back to a previous page. i already disabled the right click menu so they don't have access to the "Back" option, but they could still hit Backspace to go back in history. block...

How to use floats with TrackBar

I'm using a TrackBar control. By default its values are int32. I would really like to use decimal values so the use can select at a more granular level. How can I get the TrackBar control to except floats? ...

Matlab 2009b & .NET

I am having all sort of trouble with [FlagsAttribute] enums in Matlab. It appears there is no way to pass a combination of values as a parameter to .NET. For example, BindingFlags.Public|BindingFlags.Instance, once you combine these together in Matlab they become of an internal type and cannot be cast back to BindingFlags. Things like ...

Form's client area not rendering size set in Form.ClientSize

I've got a System.Windows.Forms.Form where I need to set the size of the client area at runtime. Strangely, though, even when I set the ClientSize property to 800x600, the area is smaller by 4 pixels on the right and bottom sides, which causes my content to be clipped by 4 pixels in both directions. This behavior is observed with both t...

How do you teach a senior developer how to be more efficient?

We have a couple senior (i.e. older) developers on our team that have no interest in improving. They write solid code, but they don't want to add unit tests or improve their efficiency. They are old-school C programmers using .NET, but everything they write is purely procedural. When confronted about their development speed (most code...

high DPI problems...

Hi, I have a problem with the display of our .NET Windows application under high dpi settings. All forms are set to AutoScaleMode = DPI, but this does not solve all the problems. Basically labels end up expanding in size to cope woth the font being bigger, but the location of other controls does not change and we end up with lables ob...

How to check how much execution time is spent in different dlls

In my project I have some code which has been deveoped in VBA and it calls functions from different C# DLLs. currently the performance of the code has been degraded and I am planning to check in which function/dll most of the execution time is spent. Kindly let me if any tool is available to check the same. ...

The member has no supported translation to SQL. When trying to access a property in my Partial class in the LINQ to SQL statement. Lamda expression?

I have 3 tables in my database Country City House Country table looks like CountryID Name City table looks like CountryID CityID Name House CountryID CityID HouseID Name I use LINQ to SQL and the above tables become classes and have their properties etc. Now I have my own abstract class called Location And cr...

Assigned id usages in Nhibernate (ORM’s)

Why are assigned id’s frowned upon in the Nhibernate world? Is there a particular disadvantage to using it? ...