DataGridView Cell Borders
Hi all
Have this code so that when a checkbox in a column of my datagridview is checked, then the corresponding cell in column 2 (of the same row the check box is in) will turn blue with font color white.
Code:
If DataGridView1.Columns(e.ColumnIndex).Name = "Column15" Then
'Choose the color based on the checkbox cell value.
Dim clr12 As Color
If DataGridView1.Rows(e.RowIndex).Cells("Column10").Value = True Then
clr12 = Color.Blue
End If
DataGridView1.Rows(e.RowIndex).Cells("Column2").Style.BackColor = Color.Blue
DataGridView1.Rows(e.RowIndex).Cells("Column2").Style.ForeColor = Color.White
I'd also like to add a line so that as well as the cell going blue, the bottom border of the cell disappears, so cellborderstyle = none.
Can't get it to work
Help is appreciated,
M
Re: DataGridView Cell Borders
Re: DataGridView Cell Borders
Hi Kevin, thanks for the link.
Do you know of any way that I can copy and paste data, for example from an excel spreadsheet or other table format, into my DataGridView and it will paste into the correct cells so its layout remains the same, eg Column A will be filled with all relevant data etc etc...is there a property on the datagridview which would allow this?
Re: DataGridView Cell Borders
Quote:
Originally Posted by
MacShand
Hi Kevin, thanks for the link.
Do you know of any way that I can copy and paste data, for example from an excel spreadsheet or other table format, into my DataGridView and it will paste into the correct cells so its layout remains the same, eg Column A will be filled with all relevant data etc etc...is there a property on the datagridview which would allow this?
No, the DataGridView does not understand copy/paste even simply data. A DataGridView with the right code can do copy/paste but not on it's own. Best to look to another solution.
Re: DataGridView Cell Borders
Hi there...sorry to bring this thread back up, but have now come to re-try this, and my ignorance means I can't get it to work ....
can you advise on the code I should use? So when the checkbox is ticked, the cell goes blue and the gridline on the bottom of that cell gets removed.
Many thanks for your continued help, Kevin!