[SOLVED] DataGridView and Control

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!
Answered
0
0

Hi,

if I have set a datagriview as Virtualmode=true, and I add a column with checkbox, the checkbox do not receive click

is it normal?

Regards

Cristian

  • You must to post comments
Best Answer
0
0

sorry if I did not explain well.

the checkbox that I have crate and place inside datagridview, are not checkable. is it normal, because it is in virtual mode?

  • Luca (ITG)
    You don’t need to create any checkbox inside the datagridview. The DataGridViewCheckBoxColumn renders the checkboxes by itself. They are checkable but since you turned on VirtualMode you have to store and retrieve the data. The alternative is to leave VirtualMode off. See CellValuePushed and CellValueNeeded and the tutorial I linked.
  • Cristian Zerbinati
    damn you’re right! sorry thanks Cristian
  • You must to post comments
0
0

I can’t understand what the code is expected to do. The checkbox is created and not shown or attached or assigned. Place it on a page or form and it will work. It’s not related to the DataGridViewCheckBoxColumn.

The datagrid sets VirtualMode on but doesn’t handle the data events. See https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/implementing-virtual-mode-wf-datagridview-control

 

  • You must to post comments
0
0

 

Private Sub Window1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
DataGridView1.VirtualMode = True
DataGridView1.RowCount = 10
'aggiungo la colonna col checkbox per la selezione
Dim col As New DataGridViewCheckBoxColumn With {
.Name = "ck",
.Width = "30",
.ReadOnly = False,
.Resizable = False,
.FillWeight = 10
}
Dim ck As New CheckBox
ck.Dock = DockStyle.Fill
DataGridView1.Columns.Insert(0, col)
End Sub

  • You must to post comments
0
0

Cannot reproduce without a test case.

  • You must to post comments
Showing 4 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
File Name Size
There are currently no files uploaded.
Maximum number of files 5, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json mixin.theme