|
-
Sep 29th, 2017, 12:10 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] DataGridView Properties
I keep finding more and more things that I end up having to set properties in the code, rather than in the properties window.
For a lot of forms I like to use groupbox containers. I understand that anything placed into a container adopts the containers property settings, just as the container adopts the form property settings. However, I generally like to set the groupbox property settings to what I like, and I might well set the property settings of any controls in the groupbox to something completely different. When executing the form I have never had any problems with the property settings of the controls in the groupbox......... with one friggin exception. DGVs!!!!
Overtime, I have found that some of the properties of the DGV will randomly change to the groupbox property settings. Well, actually only one. The Default Cell Style properties. What occurs is that this property will randomly revert to the combobox property settings. When I say randomly I mean that the form will execute flawlessly for awhile, then on an execution the property reversion occurs. Which brings me back to setting the properties in the code rather than the DGV properties window. So here is what the DGV properties window looks like:

So I have placed the settings for each of the properties, but seem to be unable to figure out how to set one of them. As can be seen, there is nothing for the font setting, which by the way I want to be, Times New Roman, 11.25pt. I have tried fill that a number of different ways, but am unable to come up with the combination that works. Can anyone give me a lift here?
Code:
With dgvItemList
.DefaultCellStyle.Font =
.DefaultCellStyle.ForeColor = Color.Black
.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft
End With
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
|