|
-
Dec 23rd, 2011, 02:31 PM
#1
Thread Starter
Addicted Member
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
-
Dec 23rd, 2011, 05:36 PM
#2
Re: DataGridView Cell Borders
-
Dec 24th, 2011, 07:24 AM
#3
Thread Starter
Addicted Member
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?
-
Dec 24th, 2011, 09:17 AM
#4
Re: DataGridView Cell Borders
 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.
-
Jan 12th, 2012, 11:31 AM
#5
Thread Starter
Addicted Member
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!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|