.net-4.0

Asp.net mvc 2 .net 4.0 error when View model type is Tuple with more than 4 items

北战南征 提交于 2019-12-07 14:16:23
问题 When I create strongly typed View in Asp.net mvc 2, .net 4.0 with model type Tuple I get error when Tuple have more than 4 items example 1: type of view is Tuple<string, string, string, string> (4-tuple) and everything works fine view: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/WebUI.Master" Inherits="System.Web.Mvc.ViewPage<Tuple<string, string, string, string>>" %> controller: var tuple = Tuple.Create("a", "b", "c", "d"); return View(tuple); example 2: type of view is

How do I specify events deep inside “Applications and Services Logs”?

巧了我就是萌 提交于 2019-12-07 14:10:29
问题 The following code snippet fires an event when an event is logged. The sample code works fine but the log I want to monitor is actually "Applications and Services Logs > Microsoft > Windows > Task Scheduler > Operational". What do I insert in place of "Application" in the code sample? ... EventLog myNewLog = new EventLog("Application", ".", "testEventLogEvent"); myNewLog.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten); myNewLog.EnableRaisingEvents = true; ... 回答1: The log name

Maximize window of another running program

心不动则不痛 提交于 2019-12-07 13:15:35
问题 How do I programmatically maximize a program that I have currently running on my pc. For example if I have WINWORD.exe running in task manager. How do I maximize it? In my code I have tried: private void button1_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Maximised; } Unfortunately that only displays my application. I would like it to maximise another exe, BUT if it cannot find it then i want to it to exit. 回答1: Using ShowWindow You can set windows state using

IISExpress serves empty pages when Visual Studio 2013 has the web project open

核能气质少年 提交于 2019-12-07 13:06:32
问题 As soon as I simply open my Asp.net MVC 3 project in Visual Studio 2013 Ultimate, IISExpress starts serving up zero byte pages. That is, the content-length is 0 and the request body is empty. Close VS, and the pages are served up correctly. I typically launch IISExpress myself from the command line. It serves up my application no problem. Once I open my project in VS 2013, suddenly empty pages are served up. Http response code is 200. I can still attach and then debug/step through. I see my

c# Linq's - GroupedEnumerable usages?

北慕城南 提交于 2019-12-07 13:06:26
问题 Fruit[] data = new[] { new Fruit {Name = "Gala",Type = "Apple",Price = 0.75m,Quantity = 10}, new Fruit {Name = "Granny Smith",Type = "Apple",Price = 0.80m,Quantity = 7}, new Fruit {Name = "Tasty",Type = "Strawberries",Price = 1.90m,Quantity = 20} }; var grouped = from fruit in data group fruit by fruit.Type; grouped type is : System.Linq.GroupedEnumerable<ConsoleApplication15.Fruit,string,ConsoleApplication15.Fruit> have a look on it : my question : if grouped contains items ( implements

c++/cli static constructor of derived class is not called

匆匆过客 提交于 2019-12-07 12:53:33
问题 As described in another SO post of me I saw a strange behaviour of my application after moving from VS 2008 (.net 3.5) to VS 2013 (and using .net 4.0, not 4.5). I found that the static constructor (cctor) of a class was not called any more. Therefore I broke the application down into a small test program: DLLs testAssembly_2-0 and testAssembly_4-0 (similar content; testAssembly_4-0 has names with 40 instead of 20 ) namespace testAssembly_20 { public ref class Class20 { public: Class20 () {

asp.net add custom control in website

和自甴很熟 提交于 2019-12-07 12:42:53
问题 I want to make a custom control in my website (note: not web application) Following is the code using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel; using System.Web.UI; using System.Web.UI.WebControls; namespace AnkitControls { /// <summary> /// Summary description for CustomTreeView /// </summary> public class CustomTreeViewControl : WebControl { } } Default.aspx : <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site

Is there a way to show part of one form on another form?

帅比萌擦擦* 提交于 2019-12-07 12:42:07
问题 I have a form. All I want to do is display a section of that form on another form. I don't want it to be functional or anything. I basically just want it to be a picture. Is that possible, and if so, how? Like display = new display(form, new rectangle(X1, X2, Y1, Y2)); Is that a possibility? 回答1: Yes you can do: Bitmap bmp = new Bitmap(myWidth, myHeight); myForm.DrawToBitmap(bmp, new Rectangle(x, y, bmp.Width, bmp.Height)); And then pass this bitmap to the other form. 来源: https:/

Problem stopping Windows Service from Installer Class. Events fire too late

久未见 提交于 2019-12-07 12:12:00
问题 I'm using Visual Studio 2010 with .NET 4.0. I have a windows service that is installed from a Visual Studio Setup Project. In the setup project I have the RemovePreviousVersion property set to True. In the project that contains the service I have an installer class that will be used to stop the service when upgrading from a previous version. So when upgrading the software the service will already exist and could be running. If it is running then during the installation the installer prompts

Do the new NoPIA and Type Equivalence features in C#/.NET 4.0 mean Microsoft.mshtml.dll is no longer needed

安稳与你 提交于 2019-12-07 11:40:30
问题 I'm maintaining a WPF based application which contains a WinForms based WebBrowser control that based on the IE web browser control. When we deploy, we have had to also supply Microsoft.mshtml.dll and do some custom configuration stuff for our ClickOnce publishing process as well in order to get things to work. I'm curious that with the new NoPIA and Type Equivalence features and dynamic type capabilities in C# 4.0 can we expect that if we upgrade that we can remove the dependencies on the