datagridview

Select only one checkbox from multiple checkbox columns in questionnaire style DataGridView

纵然是瞬间 提交于 2020-06-16 04:18:26
问题 I've create an application which displays a DataGridView with a series of questions. The dgv structure consists of one string column for the question text and three bool/checkbox columns for the answers (yes, no, N/A). Each single question is displayed on its own row. I would like my program to only allow the user to select only Yes, only No or only N/A on each row. I think I would need to uncheck the other checkbox options when one option is checked but I'm not too sure on how to do this. I

How to keep virtualmode datagridview from calling cellvalueneeded while updating data in the background in C#

元气小坏坏 提交于 2020-06-13 06:09:21
问题 I have a datagridview with VirtualMode = true that I have also implemented drag/drop to enable the user to reorder rows within the datagridview. My issue is even though I am using SuspendLayout/ResumeLayout, the datagridview is still calling CellValueNeeded in the middle of processing causing my program to crash. Within the DragDrop event, I have the following code where 'dragRow' is the source row and 'row' is the destination of the drag/drop event. gridview.SuspendLayout(); try { // copy

How to keep virtualmode datagridview from calling cellvalueneeded while updating data in the background in C#

梦想与她 提交于 2020-06-13 06:07:53
问题 I have a datagridview with VirtualMode = true that I have also implemented drag/drop to enable the user to reorder rows within the datagridview. My issue is even though I am using SuspendLayout/ResumeLayout, the datagridview is still calling CellValueNeeded in the middle of processing causing my program to crash. Within the DragDrop event, I have the following code where 'dragRow' is the source row and 'row' is the destination of the drag/drop event. gridview.SuspendLayout(); try { // copy

Import Excel file to Datagridview in C# or VB.Net

前提是你 提交于 2020-05-16 12:31:34
问题 hi i have excel file with following fields name,mobileNo,TotalCoupen.i want to import these field in datagridview with unique serial no.if a person have total 5 coupen it will show 5 coupen serial like (10001,10002,10003,10004,10005) i also attach image here is my code this code load excel file successfuly but not generate coupen no it only import excel file using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Linq; using System.Text;

ComboBox added programmatically to DataGridView doesn't open until after the cell loses focus and then is clicked on again

ε祈祈猫儿з 提交于 2020-04-18 05:46:37
问题 In a C# WinForms project I am populating a DGV from a DataTable . When a user clicks on the cell of one of the columns I need to populate a ComboBox and open it on one click . However the CBO will only open when the cell in question loses focus (click somewhere else on the form) and then gets focus back (click in that cell again) - and only if the CBO's down arrow is clicked, not if the CBO's text is clicked. I also need the CBO to open when the CBO's text is clicked. private void

How to update the content of DataGridView present in another form after the data is bound

你说的曾经没有我的故事 提交于 2020-04-17 20:41:05
问题 I have WordAddin & it has n forms. Of Which below are 2 forms TaskPane RibbonPane RibbonPane has button on the click of which I need to add rows in DataGridView docked inside a TabPane contained in TaskPane. But the data in the datagrid view(or textbox) is set to the value that is set in the TaskPane constructor. While my requirement is on ButtonClick contained in RibbonPane I need to update the content of the DataGridView(i.e., Add Rows) //Ribbon.cs public void btnSubmitClick(object sender,

How to update the content of DataGridView present in another form after the data is bound

喜欢而已 提交于 2020-04-17 20:40:08
问题 I have WordAddin & it has n forms. Of Which below are 2 forms TaskPane RibbonPane RibbonPane has button on the click of which I need to add rows in DataGridView docked inside a TabPane contained in TaskPane. But the data in the datagrid view(or textbox) is set to the value that is set in the TaskPane constructor. While my requirement is on ButtonClick contained in RibbonPane I need to update the content of the DataGridView(i.e., Add Rows) //Ribbon.cs public void btnSubmitClick(object sender,

How to update the content of DataGridView present in another form after the data is bound

爱⌒轻易说出口 提交于 2020-04-17 20:39:54
问题 I have WordAddin & it has n forms. Of Which below are 2 forms TaskPane RibbonPane RibbonPane has button on the click of which I need to add rows in DataGridView docked inside a TabPane contained in TaskPane. But the data in the datagrid view(or textbox) is set to the value that is set in the TaskPane constructor. While my requirement is on ButtonClick contained in RibbonPane I need to update the content of the DataGridView(i.e., Add Rows) //Ribbon.cs public void btnSubmitClick(object sender,

How to highlight search Arabic text in DataGridView?

纵然是瞬间 提交于 2020-04-16 12:47:28
问题 I want to highlight the given search text in the DataGridView but the data is in Arabic. I have tried CellPainting event to find the bounds of the search text and draw FillRectangle, but I could not exactly get the bounds of the search text. The following code was the one I used: private void dgv_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { // High light and searching apply over selective fields of grid. if (e.RowIndex > -1 && e.ColumnIndex > -1 && dgv.Columns[e

How do I prevent a DataGridView from sharing rows?

你说的曾经没有我的故事 提交于 2020-04-16 04:59:26
问题 I've made a custom DataGridViewCell that displays a custom control instead of the cell; but if the DataGridView uses shared rows, then the custom control instance is also shared, so you get strange behaviour (for example, hovering over buttons highlights all the buttons). Also, I can't access the DataGridViewCell.Selected property, so I don't know what colour to paint the row. How do I prevent a DataGridView from sharing rows? I know I can add the rows using the Rows.Add(object[]) override,