Dear All,
Could anyone please tell me how to freeze a Column & a Row in DataGridView?
Appreciate any help,
Regards,
Printable View
Dear All,
Could anyone please tell me how to freeze a Column & a Row in DataGridView?
Appreciate any help,
Regards,
You have seen me post before that if you want to do something with or to a class you should read the documentation for that class. You want to freeze a row and/or column in a DataGridView? A quick look at the member listings for the DataGridViewRow and DataGridViewColumn classes and their Frozen properties jump out pretty quickly.
Dear jmcilhinney,Quote:
Originally Posted by jmcilhinney
Thanks for the info, i found it ;) it's working ;) "It looks like that I didn’t search well" :blush:
I have one more Question! How can I prevent the user from sorting a column Ascending or descending? I tried this
Me.DataGridView3.AllowUserToOrderColumns = False but it’s not working?? Any idea please ;)
Appricaite your help,
That property controls whether the user can move a column to the left or right, not whether they can sort the data by that column. For that you have to set the SortMode property of the particular column to NotSortable.
Note that many people try to use the search feature of MSDN and come up short because of less than perfect key word selection. Searching should be your second choice though. Like I said, if you want to do something with or to an instance of a class you should go directly to the documentation for that class. To do that you use the index in your local MSDN library that you installed along with VS. It won't always give you what you need but I've found thatit does many more times than it doesn't. Only if you don't know what class to use should you resort to searching. You might have thought to look at the DataGridView doco first but when that yielded nothing you should have gone straight to the DataGridViewRow and DataGridViewColumn class topics because you know that what you wanted to do affected those classes.
Note also that I have learned a lot from doing as I describe because I pick up information besides what I was looking for. Often while you're looking for a member to do one thing you'll see several other unfamiliar members that may come in handy now or later. That's how I've learned a large portion of what I know and I suggest that everyone else endeavour to do the same. The one who'll benefit is you.
Dear jmcilhinney,
Again thank you for the info.
I totally agree with you. You know every time I face a problem or need to find info I use MSDN, but sometime you don’t get what you want. That’s why I ask you and others. I respect all what you said, because this is the right way to learn. Really, because of you I found the solution, I read all the members and properties and I found the solution.
Hats off to you ;) :wave:
Have a nice day..