winforms

Updates in the DataSource reset CheckedListBox checkboxes

女生的网名这么多〃 提交于 2021-02-10 20:24:13
问题 I have a CheckedListBox, binded to a BindingList: private BindingList<string> list = new BindingList<string>(); public MyForm() { InitializeComponent(); list.Add("A"); list.Add("B"); list.Add("C"); list.Add("D"); checkedListBox.DataSource = collection; } When a certain button is clicked the list is updated: private void Button_Click(object sender, EventArgs e) { list.Insert(0, "Hello!"); } And it works fine, the CheckedListBox is updated. However, when some of the items are checked, clicking

Moving PictureBox using Timer

假如想象 提交于 2021-02-10 20:15:19
问题 Basically what I'm trying to do is to make a picture box go up, then left, then down, then right, all based on timer ticks. I'm fairly new so I don't really know what's wrong. If you guys could give a simple answer or a better approach, that'd be great. Dim slides As Integer slides += 10 If slides < 20 Then PictureBox1.Left += 10 ElseIf slides > 20 AndAlso slides < 40 Then PictureBox1.Top += 10 ElseIf slides > 40 AndAlso < 60 Then PictureBox1.Left -= 10 ElseIf slides > 60 AndAlso < 80 Then

C#: Bind Dictionary<string, List<string>> to DataTable

纵饮孤独 提交于 2021-02-10 20:13:04
问题 I have one dictionary Like Dictionary<string, List<string>> first=new Dictionary<string, List<string>>(); I want to bind this dictionary to data table such that data table ColumnName should be key of the dictionary and respective columns should contain their dictionary values. What I tried: Dictionary<string, List<string>> some= new Dictionary<string, List<string>>(); System.Data.DataTable dt = new System.Data.DataTable(); foreach (var entry in some) { if (entry.Value.Count > 0) { dt.Columns

C#: Bind Dictionary<string, List<string>> to DataTable

[亡魂溺海] 提交于 2021-02-10 20:01:11
问题 I have one dictionary Like Dictionary<string, List<string>> first=new Dictionary<string, List<string>>(); I want to bind this dictionary to data table such that data table ColumnName should be key of the dictionary and respective columns should contain their dictionary values. What I tried: Dictionary<string, List<string>> some= new Dictionary<string, List<string>>(); System.Data.DataTable dt = new System.Data.DataTable(); foreach (var entry in some) { if (entry.Value.Count > 0) { dt.Columns

Converting List<object> to ListView items (with subItems)

ε祈祈猫儿з 提交于 2021-02-10 20:00:42
问题 I have a pre-configured ListView (with column headers already set up), that I would like to task a list of object, and write - as rows to that listview - specific attributes of the class I have a list of. I'm trying to follow this existing question, while it perfectly handles an item with only one column, I'm not sure how to apply multiple sub items. I have a class that contains a List<Product> which is being handed off to a UserControl that takes that list and adds each product item to a

How to set file type association in C#

社会主义新天地 提交于 2021-02-10 19:42:17
问题 I have a MDI application. This MDI application has lots of other tools including an editor as well. I would like to open all the ".txt" files with the editor of my MDI application, thereby making my application as the default viewer of all the ".txt" files. Whenever the user edits a ".txt" File the MDI application should launch and a editor window should be populated with the contents of the chosen ".txt" file . Is there a way I can do that please. Thanks 回答1: You need to change this reg key:

How to set file type association in C#

倾然丶 夕夏残阳落幕 提交于 2021-02-10 19:41:56
问题 I have a MDI application. This MDI application has lots of other tools including an editor as well. I would like to open all the ".txt" files with the editor of my MDI application, thereby making my application as the default viewer of all the ".txt" files. Whenever the user edits a ".txt" File the MDI application should launch and a editor window should be populated with the contents of the chosen ".txt" file . Is there a way I can do that please. Thanks 回答1: You need to change this reg key:

Unresolved reference to symbol 'WixUI:WixUI_InstallDir' in section for JAVA FX Deploy

隐身守侯 提交于 2021-02-10 18:37:27
问题 I created a java fx application and am customizing the MSI installer. I added my Software.wxs to the package/windows directory and I am getting the error: Unresolved reference to symbol 'WixUI:WixUI_InstallDir' in section I understand I need to reference C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll which I have seen documentation for in visual studios & in command line but I am using eclipse with the build.xml ANT deploy. If i do not reference any WixUIExtension's my

MessageBox does not suppress keyboard Enter key

此生再无相见时 提交于 2021-02-10 18:25:40
问题 I have a button which, on Click event I made some validations upon some TextBox es in my Form . If a TextBox does not pass the validation, then I force the Focus to it (user must enter some characters in that TextBox ). My TextBox class already have some code to go to the next control if user will press Enter key. MyTextBox.cs class public class MyTextBox : TextBox { public MyTextBox(){ KeyUp += MyTextBox_KeyUp; KeyDown += MyTextBox_KeyDown; } private void MyTextBox_KeyDown(object sender,

using windows forms execute a .exe file

送分小仙女□ 提交于 2021-02-10 16:21:41
问题 I want to execute a .exe file which starts my node.js app using windows forms(vb.net) on a button click. I am using Process.Start("C:\Users\PROG21\Desktop\chat\start.exe") The problem is it starts the command window and just within 3-4 seconds it automatically closes.Why is that so? This is happening only with Node.js app ,the other .exe files run smoothly through this code. And also on other button click i want to close the command window terminating the Node.js app.How can i achieve it? Any