.net

How to disable Undo in Rich Text Box in WPF?

强颜欢笑 提交于 2021-02-07 12:32:54
问题 I want to disable undo redo feature of textbox and richtextbox. Please tell how to do this. 回答1: Set the UndoLimit property of your Textbox to 0 . Should work. 回答2: You can use the IsUndoEnabled property: <TextBox Name="yourTextBox" IsUndoEnabled="False" /> 来源: https://stackoverflow.com/questions/6732586/how-to-disable-undo-in-rich-text-box-in-wpf

How to disable Undo in Rich Text Box in WPF?

天涯浪子 提交于 2021-02-07 12:32:02
问题 I want to disable undo redo feature of textbox and richtextbox. Please tell how to do this. 回答1: Set the UndoLimit property of your Textbox to 0 . Should work. 回答2: You can use the IsUndoEnabled property: <TextBox Name="yourTextBox" IsUndoEnabled="False" /> 来源: https://stackoverflow.com/questions/6732586/how-to-disable-undo-in-rich-text-box-in-wpf

Abstract class > mandatory constructor for child classes [duplicate]

风格不统一 提交于 2021-02-07 12:28:43
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Why can’t I create an abstract constructor on an abstract C# class? How can I write one abstract class that tells that is mandatory for the child class to have one constructor? Something like this: public abstract class FatherClass { public **<ChildConstructor>**(string val1, string val2) { } // Someother code.... } public class ChildClass1: FatherClass { public ChildClass1(string val1, string val2) { // DO

Calling Select() on WPF text box doesn't do anything

妖精的绣舞 提交于 2021-02-07 12:24:15
问题 I'm using a WPF TextBox, and I'm calling the Select() method to make a selection. Unfortunately, it doesn't seem to work unless I select something manually first. Can someone suggest as to why it happens? 回答1: Does your textbox have focus when you call the Select method? The selection will not show unless it has focus, but the common way for the textbox to get focus is by clicking on it...which deselects the text. This behaviour could give the impression that it's not working. Calling TextBox

How to determine memory usage in my .NET application

早过忘川 提交于 2021-02-07 12:23:32
问题 I have a website where some user can upload his dll. I need to create an instance from this dll and call a specific method. Moreover, I need to do it with several dll's in 1 process, so it is not an option for me to use System.Diagnostics.Process. Is there a way to determine how much memory does this method call use or limit it in my application runtime? Thanks in advance for any help 回答1: Memory usage in .Net is very difficult to gauge - It will depend on a lot of factors like whether

ASP.NET Identity without Entity Framework

浪子不回头ぞ 提交于 2021-02-07 12:14:39
问题 Is it possible to use the new ASP.NET Identity without using Entity Framework and instead use your own methods? I have an MVC project that uses plain ADO.NET for data access. I want to implement ASP.NET identity but I would like to continue to use ADO.NET and stored procedures. This is the way that I have chosen to go. 回答1: I had similar requirements to yourself and have implemented a pure SQL Server version of the ASP.NET Identity framework. I started out by creating a sample project (using

Starting a windows application from a windows service

懵懂的女人 提交于 2021-02-07 12:10:18
问题 I am trying to start a windows application from a windows Service using the below code Process.Start(@"filename.exe"); In windows 7 I receive a popup that says, "A program running on this computer is trying to display a message" 回答1: have a look at the following link: http://www.codeproject.com/KB/vista-security/SubvertingVistaUAC.aspx 回答2: You cannot start an interactive application from a Windows Service. This was changed in Windows Vista and 7. Some other advice was given in this Stack

Starting a windows application from a windows service

烂漫一生 提交于 2021-02-07 12:06:34
问题 I am trying to start a windows application from a windows Service using the below code Process.Start(@"filename.exe"); In windows 7 I receive a popup that says, "A program running on this computer is trying to display a message" 回答1: have a look at the following link: http://www.codeproject.com/KB/vista-security/SubvertingVistaUAC.aspx 回答2: You cannot start an interactive application from a Windows Service. This was changed in Windows Vista and 7. Some other advice was given in this Stack

C# marshal unmanaged pointer return type

馋奶兔 提交于 2021-02-07 11:59:52
问题 I have an unmanaged library which has a function like this: type* foo(); foo basically allocates an instance of the unmanaged type on the managed heap through Marshal.AllocHGlobal . I have a managed version of type . It's not blittable but I have MarshalAs attributes set on members so I can use Marshal.PtrToStructure to get a managed version of it. But having to wrap calls to foo with extra bookkeeping to call Marshal.PtrToStructure is a bit annoying. I'd like to be able to do something like

Why doesn't the C# compiler catch an InvalidCastException [duplicate]

一曲冷凌霜 提交于 2021-02-07 11:56:16
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: Compile-time and runtime casting c# As I understand it, the following code will always compile, and will additionally always fail at run-time by throwing an InvalidCastException . Example: public class Post { } public class Question : Post { } public class Answer : Post { public void Fail() { Post p = new Post(); Question q = (Question)p; // This will throw an InvalidCastException } } My questions are... If my