winforms

Simplest way to perform data validation for fields on Windows Forms

試著忘記壹切 提交于 2021-02-07 13:42:00
问题 I have a windows form project in which I want to force the user to enter values in certain fields before he presses the calculate button at the bottom. The fields include three pairs of radio buttons , five text boxes and one combo box . So basically all these fields need to contain a value in order to perform the calculations. Additionally, the text boxes should contain numbers - any double values. Moreover, I want to set a maximum value set for most of these text boxes which the user cannot

Simplest way to perform data validation for fields on Windows Forms

青春壹個敷衍的年華 提交于 2021-02-07 13:41:37
问题 I have a windows form project in which I want to force the user to enter values in certain fields before he presses the calculate button at the bottom. The fields include three pairs of radio buttons , five text boxes and one combo box . So basically all these fields need to contain a value in order to perform the calculations. Additionally, the text boxes should contain numbers - any double values. Moreover, I want to set a maximum value set for most of these text boxes which the user cannot

Simplest way to perform data validation for fields on Windows Forms

℡╲_俬逩灬. 提交于 2021-02-07 13:41:24
问题 I have a windows form project in which I want to force the user to enter values in certain fields before he presses the calculate button at the bottom. The fields include three pairs of radio buttons , five text boxes and one combo box . So basically all these fields need to contain a value in order to perform the calculations. Additionally, the text boxes should contain numbers - any double values. Moreover, I want to set a maximum value set for most of these text boxes which the user cannot

Wrong font displayed at runtime

☆樱花仙子☆ 提交于 2021-02-07 12:05:17
问题 I am using the Calibri font in some labels (winforms) and when I run my program, this label are displayed with a different font. I had seen this problem when testing on computers without Office (hence no Calibri installed) but now I see it everywhere, even on my computer where Calibri is well installed (and I see the labels with Calibri in the designer ; then when I run in debug mode, I see another font). The labels used to be displayed well, I've seen this problem only today (but could have

Winform dialog with WPF window as Parent

怎甘沉沦 提交于 2021-02-07 11:29:10
问题 I have a WinForm dialog and I want to set its Parent property to a WPF window. How can I do this? 回答1: Consider passing parameter to ShowDialog method instead of using Parent property. You can write helper class class Wpf32Window : IWin32Window { public IntPtr Handle { get; private set; } public Wpf32Window(Window wpfWindow) { Handle = new WindowInteropHelper(wpfWindow).Handle; } } public static class WindowExtensions { public static IWin32Window GetWin32Window (this Window parent) { return

Create a Windows Form from a background Thread

烈酒焚心 提交于 2021-02-07 09:32:36
问题 I'm developing a VS Package and I have this problem: I have a Background-Thread which checks every few seconds for specific changes that have to be done. This includes changing the GUI of VS 2010, which works perfectly fine without an invoke for some reason. Anyway if I try to open a new Form, it opens, but it doesn't show anything, kind of crashes and doesn't respond. I've already tried Application.OpenForms[0].invoke( /* delegate to create the form */) . This works fine, but I don't have an

Create a Windows Form from a background Thread

戏子无情 提交于 2021-02-07 09:31:44
问题 I'm developing a VS Package and I have this problem: I have a Background-Thread which checks every few seconds for specific changes that have to be done. This includes changing the GUI of VS 2010, which works perfectly fine without an invoke for some reason. Anyway if I try to open a new Form, it opens, but it doesn't show anything, kind of crashes and doesn't respond. I've already tried Application.OpenForms[0].invoke( /* delegate to create the form */) . This works fine, but I don't have an

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime - Researched solutions not working

有些话、适合烂在心里 提交于 2021-02-07 09:24:25
问题 The following is my full error: Error in Microsoft.SqlServer.Dts.Runtime.TaskHost The Execute method on the task returned error code 0x80131621 (Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. The Execute method must succeed, and indicate the result using an "out" parameter. I have found possible solutions here and here however I am still getting the above error. The following is my

Cursor flickers when trying to resize image in RichTextBox

时光怂恿深爱的人放手 提交于 2021-02-07 08:30:03
问题 I hope this is a simple question. I do the following: In VS2010, I create a Windows Form Application From the Toolbox, drag RichTextBox control to the form Size the form and RichTextBox control large enough to display a small picture. Run (start debugging). Copy a small image from a web browser and paste to richtextbox (using ctrl-v). Select the image in the richtextbox. A resize frame is displayed with small boxes. Now when I position the cursor over one of the small resizer boxes, the

Cursor flickers when trying to resize image in RichTextBox

扶醉桌前 提交于 2021-02-07 08:29:57
问题 I hope this is a simple question. I do the following: In VS2010, I create a Windows Form Application From the Toolbox, drag RichTextBox control to the form Size the form and RichTextBox control large enough to display a small picture. Run (start debugging). Copy a small image from a web browser and paste to richtextbox (using ctrl-v). Select the image in the richtextbox. A resize frame is displayed with small boxes. Now when I position the cursor over one of the small resizer boxes, the