hi guys! Is it posible to have a custom font on each row of DataGridView? says, in 1st Row the text are in normal font size, in the 2nd row the Text are in Bold and in the 3rd row the Text are in Italics. Thanks in advance!
I have another question guys...In my windows form i have a DatagridView, my question is why is it that everytime the form is load the "SelectionChanged" events is tiggered why is that? Since i dont make any selection yet. Or can you suggest guys to where I can put my code that I want to be executed everytime my user click on any rows of my DataGridView or Everytime the selected row has changed...Thanks in advance!
Last edited by daimous; Oct 9th, 2007 at 10:42 PM.
When you change the value of the CurrentCell property, the SelectionChanged event occurs
If your grid is the first control in the tab order then it gets focus when the form loads and thus the CurrentCell becomes the first cell in the grid, thus the SelectionChanged event is raised. If the grid is not first in the tab order then the SelectionChanged event won't be raised until the grid first gets focus.
Well if that is the case...i really have a problem...Can you help me guys to come up with an alternative solution..Basically what im trying to do is, I have a DataGridView and initially when that is loaded the Rows are in Bold letters but when my user click on a row the FontStyle on that row will be turned to regular and that serve as my user's cue to rows that already been selected Hope you get my point guys...Please see attached screenshot
Just declare a boolean variable that indicates whether the form has already been shown or not. Set it to false initially and then set it to true in the Shown event handler. In your SelectionChanged event handler you test this variable and if it's false you know not to do anything.
Alternatively, you can set the CurrentCell to null in the Shown event handler, which should raise the SelectionChanged event again and your code will presumably re-embolden the row.