datagridview

For a Windows Forms Application using `DataGridView`, how can I check a value in my DataSource and change the color of a separate cell?

懵懂的女人 提交于 2020-01-17 06:32:10
问题 Very specific question, I know. I'm not sure how best to word this. Currently, my cell_formatting method will change the color of a cell based on its value: dataGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.cell_formatting); .... public void cell_formatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e) { if (dataGridView.Columns[e.ColumnIndex].Name.Equals("LocCode")) { if (e.Value.ToString() == "OK") { e.CellStyle

How can I dynamically detect the characters in a DataGridView cell? / Execute code after KeyDown returns and before KeyUp?

左心房为你撑大大i 提交于 2020-01-17 06:09:21
问题 How can I dynamically detect the characters in a DataGridView cell(while it is being edited)? For example, I have a Winforms application with a DataGridView and a TextBox private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (e.Control is TextBox) { var tbox = (e.Control as TextBox); // De-register the event FIRST so as to avoid multiple assignments (necessary to do this or the event // will be called +1 more time each time it's

How can I dynamically detect the characters in a DataGridView cell? / Execute code after KeyDown returns and before KeyUp?

回眸只為那壹抹淺笑 提交于 2020-01-17 06:08:08
问题 How can I dynamically detect the characters in a DataGridView cell(while it is being edited)? For example, I have a Winforms application with a DataGridView and a TextBox private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (e.Control is TextBox) { var tbox = (e.Control as TextBox); // De-register the event FIRST so as to avoid multiple assignments (necessary to do this or the event // will be called +1 more time each time it's

Custom NumericUpDown Cell Flickering

我只是一个虾纸丫 提交于 2020-01-17 05:32:12
问题 I'm implementing a custom NumericUpDown cell into my dataGridView using this tutorial from Microsoft: https://msdn.microsoft.com/en-us/library/aa730881(v=vs.80).aspx It's working good, but the problem is that when Im NOT editing its value, my form/grid start to flick like crazy, and when I click to edit the value it stop. My form is already "Double Buffered", so I'm not sure what to do anymore. The code can be find in the link above, but I'm posting both classes I'm using to make it work:

How do I immediately change the row color when the selected index of a DataGridViewComboBox changes?

ぃ、小莉子 提交于 2020-01-17 05:16:37
问题 I'm using Windows Forms and have a DataGridView with a DataGridViewComboBoxColumn that is bound to a data source. When the user chooses a different item from the combo box, I'd like to immediately change the row color to indicate this new selection. I've tested several events such as CellValueChanged and RowPrePaint, but these requires that the user clicks off the row after making the selection. It seems like the row doesn't update immediately. Instead, it updates after the user clicks off

DataGridView overrides my custom row painting

ε祈祈猫儿з 提交于 2020-01-17 04:55:09
问题 I'm following the example on MSDN for using the RowPrePaint event to custom paint my rows. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.rowprepaint(v=vs.110).aspx I only want to custom paint some rows, not all. I also have an alternating row style applied. When I stepped through the debugger I was able to watch the program paint the row according to the example in MSDN (a subtle gradient), but as soon as the RowPrePaint event handler returned the program repainted

C# Visual Studio: How do I update a DB from Edit with DataGridView using LINQ?

我怕爱的太早我们不能终老 提交于 2020-01-17 04:43:26
问题 I have a form WinForms form window with a DataGridView. It pulls data from a SQL Server Express database using Linq and displays it in the DataGridView columns properly. I have it set in the properties to allow editing. When I edit and change a field during runtime it will only update the database if I specify one column name. This doesn't work well because I need it to update the column I edit, not the one hard coded. It needs to be dynamic. See the comments next to site.??? I can choose a

How to check a checkbox created with VB's DataGridViewCheckBoxColumn on Runtime

牧云@^-^@ 提交于 2020-01-17 03:41:25
问题 I wanted to check/tick a column created with DataGridViewCheckBoxColumn on runtime. here's a snippet of my code; Dim checkCol As DataGridViewCheckBoxColumn = New DataGridViewCheckBoxColumn() DataGridView1.Columns.Add(checkCol) After I added this column, I wanted to check/tick some of these checkboxes on start up of the VB application. How do I do that? Do I have to make use of some of the methods from Checkbox Class? thanks 回答1: A CheckBox accepts two values: True (checked) or False

DataGridView System.Data.ConstraintException on row enter

ⅰ亾dé卋堺 提交于 2020-01-17 03:13:44
问题 Just as a starting note: I'm going through an existing app which was passed down to us and trying to go through and fix the bugs. I've been having issues with one particular DataGridView erroring out; giving me a Unique Constraint Exception on the ID. The strange thing is that I don't receive this error when I add the new item to the table, I receive it when I try to select a row (any row, it doesn't have to be the newly added item) in the DataGridView. When you add an item to this table it

How to add data from Firebase to DataGridView using FireSharp

不羁岁月 提交于 2020-01-17 00:38:50
问题 I just want to retrieve data from a Firebase to DataGridView. The code I have is retrieving data already, however, it's retrieving everything to the same row instead of creating a new one. I'm a beginner in coding, so I really need help with that. I read online that Firebase doesn't "Count" data, so it'd be needed to create a counter, so each time I add or delete data, an update would be needed. I did it and it's working. I created a method to load the data. private async Task firebaseData()