How can you databind a single object in .NET?

I would like to use a component that exposes the datasource property, but instead of supplying the datasource with whole list of objects, I would like to use only simple object. Is there any way to do this ? The mentioned component is DevExpress.XtraDataLayout.DataLayoutControl - this is fairly irrelevant to the question though.

Working with .qr2 reports in .NET?

We use an ERP that has a bunch of reports in QuickReport format (.qr2). From what I could search, Quickreports has an interface for Delphi but not for .NET. Anyone know if there's a (preferably free/OSS) solution for converting .qr2 reports to something I could work with in C#? Or a component for reading these reports directly?

.net When Would You Prefer DateTime Over DateTimeOffset

A few months ago I was introduced to the new DateTimeOffset type and was glad DateTime's flaws with regard to time zones were finally taken care of. However, I was left wondering if there were any overhead or problems that could occur from using this new type. I work on a multi-locale web application. Does anyone know of anything that could sway me from just using it for all my date/time work? Is there a window for abuse here? Reference: DateTimeOffset: A New DateTime Structure in .NET 3.5 by

About usage of DefaultValueAttribute Class in .Net

So here is the simple code: [System.ComponentModel.DefaultValue(true)] public bool AnyValue { get; set; } I am sure I don't set AnyValue to false again (I just created it). This property is a property of a Page class of ASP.NET. And I am cheking the value in a button event handling function. But somehow it is still false. I wonder when actually it is set true? On compile time? When class is instantiated? What do you think about what I am doing wrong?

How can I extract a specific Image from an Icon file in .NET?

Icon files (*.ico) may contain multiple images at different sizes and of different colour depths. How can I obtain a System.Drawing.Image object from a .ico file? One option is Image.FromFile(...), but for icon files with multiple images there is no way to specify which image size and colour depth to return. Ideally the solution would use only managed code, but I'm happy to hear about interop calls to Win32 functions as well.

.net What is the "Weak Event" pattern used in WPF applications?

The WindowsBase DLL defines the IWeakEventListener event with summary: Provides event listening support for classes that expect to receive events through the WeakEvent pattern and a System.Windows.WeakEventManager. This vague description doesn't describe what the 'WeakEvent pattern' actually is. So, what is this pattern, why is it used and is it useful outside of WPF applications? EDIT Some good answers already, but no one has talked about whether this pattern is useful outside of WPF ap

How to measure memory leaks in .NET in a reliable and automatic way?

I wrote an automated test in order to ensure that our application does not leak (managed & unmanaged memory) now AND later as development grows up. The problem is that my test does NOT seem reliable, but I don't know whether this is inherent to .NET and leak definition or to the test. It happens this way: long start = PrivateBytes; // here is the code for an action which is expected to be memory-constant long difference= PrivateBytes-start; Console.WriteLine(difference); // or Assert(d

.net WPF - How to combine DataTrigger and Trigger?

NOTE I have asked the related question: How to combine DataTrigger and EventTrigger? I have a list box containing several items. The item's class implements INotifyPropertyChanged and has a property IsAvailable. I use that property to indicate unavailable options in the list using a different colour. However, if a selected item is not available, then the foreground colour should be red. <ListBox> <ListBox.Resources> <DataTemplate DataType="{x:Type local:InstitutionView

.net OrderBy ThenBy in F#

Is there any function in F# similar to LINQ fluent syntax for sorting by multiple expressions: myList.OrderBy(fun x->x.Something).ThenBy(fun x->x.SomethingElse) I'd love something like: myList |> Seq.sort_by(fun x->x.Something) |> Seq.then_by(fun x->x.SomethingElse) Thx

Is Mono for OS X any good for a professional .NET developer?

As a professional .net developer (at least this is how I earn my money) I wonder if Mono for the Mac is worth a closer look. I already tried Mono 3 years ago when I first got my iMac but the installation was impossible to master and after half a day I just gave up. I also got help from a Unix professional but we both were unable to get Mono running on my Mac. Like I said that was some years ago. How is the state of Mono for OS X today? Installation still painful? How about compatibility to .NET

.NET copy protection

Is it possible to restrict a .NET executable to a specific machine somehow so that it can only be run on that machine.

.net Removing (or updating) an image from RichTextBox

I have a question related to managing OLE objects in a RichTextBox. What I've found so far is lots of info, but not exactly what I need, so I will make a quick introduction first (I also hope someone might find this helpful). 1. What I know so far First of all, I am using OLE to insert images (or any ActiveX) into the RichTextBox. This is supposed to be "the right way" to do it, since there is no clipboard involved, and you can insert any ActiveX control you want. There is an article on CodeP

Run login script from .NET application

I am writing a small utility that, among other things, will allow the user to run his/her logon script. It is a .NET application that will run on Windows XP/Vista/7 PCs that are joined to an active directory domain. The PCs belong to different organizational units and will be running different scripts. Is there an environment variable that I can query that will tell me the script that ran when the user logged on? Or will I have to include it in the config file and make sure that every PC is

.net I'm being attacked - what can I do?

Someone is putting this code onto my aspx page. What are they doing? How are they doing it? How do I stop them? It's on a shared hosting server. It's on an aspx content page which has a master page and is after the </asp:content> tag... <div style="display:none">qzfmjsdbknmrmlkszrrcehikeapphqq</div> <div style="display:none">owhkhminltvnwvegxktzemrszyykcsh</div> <div style="display:none">cljwdrmbxglllikbjctmpyvcflzxbqk</div> <div style="d

.net Running SQL Azure as a Cluster Node

Seeing as to how I can't find anything at all about it on the interwebs, I suspect that the answer is no, but I figured I'd ask... Does anyone know (for certain) if you can run SQL Azure as a node in a cluster of servers? Essentially, we've invested in a SQL server and are looking at adding another node to the cluster. However, it would be really cool if instead of purchasing another box, we could instead just tack on SQL Azure as a part of our cluster. This would allow us to "test the waters"

.net Function return System.IO.MemoryStream?

I trying to display image in picture box. The application have two part. First part is windows application, and second part is web service (asmx). This is the code for windows application: Public Sub PrikazSlike() Dim p As localhost.Service1 = New localhost.Service1() PictureBox1.Image = Image.FromStream(p.PictureShow()) End Sub And this is the code for web service: Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports

.net Impact of Multiple .ToUpper()'ing

This is not a question of premature optimization per se. On the garbage collector and memory in general, what would hundreds of ToUpper() operations (many could be duplicated) do to a program, mainly in regard to the immutability of strings?

.NET: What is the object header used for?

In .NET there are 8 bytes of overhead for each object. 4 bytes are a pointer to the object's type. What are the other 4 bytes, known as the object header, used for? Note: the question was asked in 2010 and is 32 bit specific. The overhead is bitness dependent: 1 pointer-size for the "object's type" (method table) and 1 pointer-size for the object header. So, that's 2*4 bytes for 32 bit and 2*8 bytes for 64 bit applications.

When is it a good idea to intern strings manually in a .Net code?

The reference is here: http://msdn.microsoft.com/en-us/library/system.string.intern.aspx Looks like this is done automatically by the compiler a lot, but can also be done manually. Please correct me if I am wrong and shed some more light on this. Does it matter whether the language is C#, VB.Net, C++/CLI, other? Thanks.

Estimate re-implementing ASP.NET MVC app using Rails

How it would be possible to approximately estimate time of re-implementing the same application in Rails while already having one implemented in ASP.NET MVC (reason - is another topic, please let's not touch it here). I am looking for some kind of metrics mapping or something that could possibly provide a rough estimation of time required. Some details about the current ASP.NET MVC2 (.NET 4) project: Project Metrics Maintainability Index - 85.4 (out of 100) Test coverage ~ 80%

.net Design for logging or adding logging afterwards?

When writing a new application or infrastructure, do you consider logging right from the start? And thus have a lot of classes importing/using an ILogger interface (inside constructor for injection) for example? What if you already have (most of) your application in place, but didn't think of logging in most or all of your classes. How would you end up adding logging to them? My concern with adding afterwards is that if you need logging deep down into your dependency chain, you might end up ha

.net uncheck checkboxlist if one listitem selected

I have the following checkboxlist. I need to uncheck rest of list items when "None" is selected. How do I do that? Thanks <asp:CheckBoxList ID="CheckBoxList1" RepeatDirection="Horizontal" runat="server"> <asp:ListItem Value="1">French</asp:ListItem> <asp:ListItem Value="2">Spanish</asp:ListItem> <asp:ListItem Value="3">Italian</asp:ListItem> <asp:ListItem Value="4">German</asp:ListItem> <asp:ListItem Value="5">P

.net How do I change a font's metadata (specifically a title)?

I need a way to dynamically change the name of a font, and I cannot find a way to do so in .net. I am not concerned about the font file type, so otf, fon, ttf are all open. Things I've tried: Using dsofile.dll / OleDocument Properties Reader. These are not the same properties used by whatever accesses the name of fonts. Changing the name directly in the registry. I've read that .fon files are just dlls in disguise, (one example), so perhaps that is a way to get to it?

Trace a .NET 1.1 Web Service call

I'm having an issue trying to find an error with a web service using .NET 1.1. In .NET 2.0/3 I can add a trace section to my web config like: <system.diagnostics> <trace autoflush="true" /> <sources> <source name="System.Web.Services.Asmx"> <listeners> <add name="AsmxTraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\subconnector\local.log" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp

.net How to stop the execution of UC at page load on Visible false

I am thinking to stop the execution of pageload if that UC has been set to Visible false at the container page. Right now I am upto the following logic public class TestControl : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { if (this.Visible) { //do heavy operation } } } i.e I will check whether the control is visible false or not in the Page load of UC, if true, then only do the operations there. Is there a

.net Is there CHM file available for VS 2010 documentation?

I have VS 2010 ultimate edition and the documentation (VS + framework classes documention) that comes along with it is in the form of HTML pages and uses in-built web server. So, whenever I need to see a topic, it starts the webserver and loads default help page, wherein I type for help topic and then it gives me that page. I was wondering if there is CHM format help available for VS 2010 (.Net Framework 4.0) documentation? It is more convenient & speedy to use CHM than HTML documentation.

.net Failure to call web service over HTTPS

I'm developing a .Net application that communicates with a web service to get some data. The connection between the .Net application and the web service is done over HTTPS. When I call the web service from the .Net application, I get the following stack trace: System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid ac

.net Detecting uninstall of a service

I have installed windows service via installshield and when i go to control panel, i can see my windows service, however when i right click on that service, i can see an uninstall option, when i uninstall, my code deletes the service. Is there anyway i can detect in the code that user has clicked "uninstall" for this service? in installshield/via vbscript? Can i detect whether user clicked uninstall for a particular windows services in control panel?

.net Porting Crystal Reports application (VB 2003, Framework 1.1)

I've been assigned to a new project. I have to maintain an application which was made in Visual Studio 2003 (VB.NET, Framework 1.1) and Crystal Reports which came included with the IDE. The application is absolutely what we call "legacy code". Just to make the test, today I've tried to convert the application in Visual Studio 2010. The converter is offering me download SAP Crystal Reports, with no cost and no registration. The question is: Does anybody has experience with this componen

.net Multiple inheritance from abstract classes

it is possible to implement this functionality? I've two abstract classes, and i want to force a third class to implement all the abstract methods in the two classes public abstract class A { private void MethodA() { var fool = Prop*2; } public abstract int Prop { get; } } public abstract class B { private void MethodB() { //.... SomeMethod(); //.... } public abstract void SomeMethod(); } public class C: A, B { public int Pr

.net Best way to store information of using first wizard page

Understand that the subject should be discussed before. But as I haven't found the proper link explaining which approach is supposed to be implemented for my specific issue, will ask you one more time. I have a big plenty of users that have access to some wizard where they can go through web pages. At first time they are supposed to change some default settings on the first page. And then choose next link. Every next time if they already updated settings they should get the second page directly

.net Why does Console.ReadKey() block output of Console.WriteLine called in another thread?

I have a very simple console app. static void Main(string[] args) { DoAsync(); Console.ReadKey(); } Here DoAsync starts set of task and returns not waiting for tasks' completition. Each task writes to Console, but the ouptut is not shown before key is pressed. When I use Console.ReadLine everything works fine. So I'm curious about ReadKey() pecularities.

.net How does adding IDisposable change the semantics of a class?

The MSDN documentation for IDisposable states that: It is a version-breaking change to add the IDisposable interface to an existing class, because it changes the semantics of the class. What exactly does this mean? I can see how removing IDisposable would be a big deal. Instantiating a class inside of a using statement would no longer be possible, for example. But what else makes IDisposable special, especially in the context of adding the interface?

.net Visual Studio 2012 not stopping at exception in debug mode

First off, i've looked at similar issues posted and they all seem to involve a 64 bit windows bug. I'm running 32 bit though, on a local machine. The application is a asp.net website with links to a number of libraries all contained inside the project solution. I'm mainly trying to understand why visual studio would just pass by this exception during debug mode. I believe it's getting generated in the CLR level, because when I enable throwing at the CLR level then VS will stop and display t

Multiple Calculations VB.NET

I'm sorry if this question has been asked so many times. But on all the posts..i could not find a clear solution. I asked my question before and it helped me very good...Still this problem remaining. Make multiple calculations without pressing the '=' sign if '5+3 =' then '8' WORKS! But if '5+5/10=' then NOT WORKS It's NOT the intention to build a difficult calcutor like (5*5)+(2+3) It should just keep doing the calculation on the previous result Made a sloppy solution that if th

.net Styling a "PART_" in WPF

I want to style part of a telerik RadDGridView, the part in question is exposed as a template part called 'PART_AddNewRow'. Is it possible to apply a style to this part, I don't want to replace the control template just style what is there?

.net DLL cannot be loaded even though file exists

I'm debugging a .NET desktop app in Visual Studio 2014 CTP on Windows 7 in a VirtualBox VM which uses a managed DLL (probably a wrapper) which in turn uses an unmanaged DLL. Both are in the same directory as the executable. The managed DLL is loaded correctly but when execution reaches a line calling a function from it, an exception is shown that the unmanaged DLL couldn't be loaded: System.DllNotFoundException. However, when I rename the unmanaged DLL and put an empty file there with the name a

Conditional .NET regex

I want to write an F#.NET Boolean function named IsStrValid using a regex that decides whether a given string s confirms to the following rules or not: s is 4-character long 1st and 3rd characters are either A, B, or C 2nd character is either 1, 2, or 3 4th character is either 1, 2, or 3, except for when the 1st and 3rd characters are the same - then the 4th character cannot be the same as the 2nd one. E.g.: IsStrValid "A3B3" //true IsStrValid "A3A3" //false This is how far I've go

.net Insufficient memory to continue the execution of the program Visual Studio 2010

I was running my computer vision project which is implemented in EmguCV(.Net Wrapper to the OpenCV) in Visual Studion 2010 (in C#). It was calculating my features from images for training and save them in a float array. After about one day of running, this error is appeared: OutOfMemoryException was unhandled Insufficient memory to continue the execution of the program As my Training Set is too big, how can I save these features in an array? considering that It was less than half of my prog

.net Accessing WebDriver from async delegate prevents future FindElements

When I invoke an Action asynchronously and interact with the WebDriver I can no longer use it to find elements: public void AsyncWebDriver() { var homePage = new Uri("http://codeseven.github.io/toastr/demo.html"); var driver = new InternetExplorerDriver(INTERNET_EXPLORER_OPTIONS); driver.Navigate().GoToUrl(homePage); Action bar = () => Console.WriteLine(driver.Url); bar.BeginInvoke(null, null); for (var i = 0; i < 5; i++)

.net NuGet restoring packages but missing DLLs

I've had a Visual Studio solution running successfully on my machine but when I've committed the changes to BitBucket and another user has pulled down the project and built it on either Visual Studio or TeamCity we've received errors such as: error CS0234: The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?) When I've looked at the project, I can see that each NuGet package folder is present but the DLLs are missing. This

.Net Winforms Databinding Parent Child

I would like create something using Windows Form to show Datas from an item and informations about childs (=Parent - Childs) Something like this : --For exemple, i have --MyParent with properties MyParent.Data1 MyParent.Data2 MyParent.Data3 MyParent.Childs() --And for child MyChild.Data1 MyChild.Data2 MyChild.Data3 So, in the first Combobox, I have my List of Items, In the second one, i have my childs from the current selected Parent Item I don't have any problem for bind parent, but that

.net Identifying erroneous field in kubernetes deployment spec in C#-client

I am trying to define a deployment spec using the C#-client of Kubernetes. The values of the fields of my spec are produced by some other application. As such, the deployment sometimes fails and I get an Unprocessable entity(Microsoft.Rest.HttpOperationException) error. However, it is really hard to identify which field results in the Unprocessable entity error. Can someone tell me how I could get identify the erroneous field? Here's the trace: Microsoft.Rest.HttpOperationException: Operation

Login SAP, with Powershell using SAP Connector for Microsoft .NET

I try to login into a SAP system using the interface SAP Connector for Microsoft .NET. It worked for me to login with another method, without SAP Connector, with sapshcut, code below: #-Start the SAP GUI----------------------------------------- $SID = "t30.lan" $SAPGUI = $SAPGUIPath + "sapgui.exe" & $SAPGUI $SID $InstanceNo & $SAPGUIPath\sapshcut.exe -maxgui -system=t30 -client=110 -user=test -pw=test01 -language=DE Now I imported the SAP Con

  1    2   3   4   5   6  ... 下一页 最后一页 共 432 页