.net

.Net DataGridViews Bound to Same Binding Source in Different Tab Pages

I have a winform (C# VS2008 .net 3.5) with a Tab Control. Two of the pages on the tab control have Data Grid Views bound to the same Binding Source. This works fine. However, there is a bug with Tab Pages in that Data Grid Views held in Tab Pages always show the first column of the bound table, whether or not it is set to visible at d...

Pass objects/vars between Page_PreInit and Page_Load

I am building pages dynamically using a database to store the page info and .NET (C#) to build pages. Part of that process is to set the masterpage (in the code-behind) based on what is in the database and, as I understand it, that has to be done in Page_PreInit. My problem is how to pass objects and variables from Page_PreInit to Page...

How do I resolve a InvalidOperationException when reading MSMQ using ActiveXMessageFormatter?

How would you avoid the InvalidOperationException created by the MSMQ sender and receiver below? Any help you can offer would be greatly appreciated! I have a feeling it might be related to the BodyType attribute of the sender, but I do not know the proper domain of values for the attribute. Sender code: using System; using System.Co...

Implementing INamingContainer Interface for UpdatePanel?

Even in trying to find an answer to this problem, I haven't found any clear explanation (especially one not discussing GridViews) on how to resolve the following error I receive when running a program with an UpdatePanel: Message: Control with ID 'lblDisplay' being registered through RegisterAsyncPostBackControl or RegisterPostBackContr...

best way to find end of body tag in html

I'm writing a program to add some code to html files I was going to use a series of indexof and loops to find what is essentially ""X (where X is the spot im looking for) It occurred to me that there might be a more eloquent way of doing this does anyone have any suggestions. what it looks like currently <body onLoad="JavaScript:top...

What do you call a looping progress bar?

Ok I'm just at a loss for what the correct terminology is for this. I'm looking for the correct name to call a progress bar that "loops". Instead of the standard progress bar that fills up from left to right to 100%, this looks exactly like the progress bar but a small portion of the fill color constantly loops, never filling the whole...

Generating Service Contract from a WSDL

I have a WSDL that I need to generate a ServiceContract (OperationContract, DataContract)... I have found a way to do it for ASMX WebServices but can't seem to find how to do it in WCF. I have tried running svcutil AuthPartnerWSDL.wsdl /i /messagecontract /tcv:version35 but the resulting interface doesn't deserialize the call comin...

How to repeat a mouse click in .NET

My app runs as a plugin inside another windowed app. Thus, my window often doesn't have the focus. Now, if someone moves the mouse over a button/menu and clicks once, all it does is set focus to my window. Then (s)he needs to click again to get the actual button functionality. This is a minor annoyance but I'd like to get rid of it. Fir...

process connecting to another process to gather profile information?

Are there any built-in mechanisms in .Net that would allow us to write two programs, A and B. A is a process with special hooks onto which B attaches itself. This would allow B to gather whatever information those hooks provided. In particular, it would be nice to be able to dial into another of our process and gather suchs metrics li...

Getting an error when using ObjectContext.AddObject with Entity Framework

I am getting an error while using the Entity Framework and C#. I am trying to save any generic Entity with a line of code similar to the following: objectContextInstance.AddObject(objectToSave.GetType().ToString(), objectToSave) The error message I receive is: The provided EntitySet name must be qualified by the EntityContainer...

What could be the reason that my custom REST serializer is not working?

Both methods MyBehavior::CreateSerializer() are not called of some reason, but ReplaceBehavior() method is working. It is changing default behavior with my custom one. Do someone know where could be the problem? The point is to write custom REST WCF serializer that should generate non-XML text format result. public class MySerializ...

Why does IEnumerable<T> derive from IEnumerable?

Duplicate: Why IEnumerable<T> inherits from IEnumerable? It looks like IEnumerable, ICollection, IList and their generic equivalents are in separate branches. ...

How to refactor a class with overloaded constructors

I have a class with overloaded constructor (C#) It can be initialized in few ways, and some parameters are optional - so in result - there is a confusing bunch of constructors new Object(StrA, StrB, ObjA) new Object(StrA, StgB, ObjB, StrC) new Object(StrA, StrB, ObjA, StrD) new Object(StrA, StrB, ObjB, StrC, StrD) new Object(StrA, StrB,...

Is there an easy way to add (#) to a filename when you find a duplicate filename?

I'm outputting files in C# and want to handle files being saved with the same name by adding brackets and a number: FooBar.xml FooBar(1).xml FooBar(2).xml ... FooBar(N).xml Is there a simple way to do that in .NET? And is there a special name for the (#) construct? ...

code that send stuff through bluetooth?

i wanna build a .net app that will have a capability of send stuff to mobile phones through Bluetooth. any suggestions? ...

Is there a way to unit test an async method?

I am using Xunit and NMock on .NET platform. I am testing a presentation model where a method is asynchronous. The method creates an async task and executes it so the method returns immediately and the state I need to check aren't ready yet. I can set a flag upon finish without modifying the SUT but that would mean I would have to keep ...

Why is Windows.Forms in System and not Microsoft?

I always had the idea that the root namespace in .NET, "System", was mainly for stuff that didn't depend too much on a particular platform. I was wondering if anyone had any ideas or insight as to why the Windows.Forms namespace is in System and not Microsoft since it seems to be fairly entrenched in one platform. (No flame wars or un...

MSBuild Error: The attribute "Remove" in element <ProjectReference> is unrecognized

I'm attempting to setup a .csproj file to have a conditional item group which will remove all of the elements in the <ProjectReference> item group. For example: <ItemGroup> <ProjectReference Include="..\..\..\..\Projects\Registrar\Ucsb.Sa.Registrar.Common\Ucsb.Sa.Registrar.Common\Ucsb.Sa.Registrar.Common.csproj"> <Project>{1ED...

What is the best way to register existing Windows service in .NET?

I need to register an existing third-party executable (database engine) Windows service from a .NET application. Is there a better way than writing to the registry? ...

URL Rewriting in .NET behaves badly with cookieless sessions

I'm currently using Intelligencia's URL Rewriter .NET HTTPModule to rewrite URLs. I am using its Custom Transform feature, which allows me to supply an assembly containing a method that performs the actual URL transform. I have cookieless sessions turned on, and this is causing some interference with the URL Rewriter. So, let's sa...