Set Datagridview RightToLeft

emshahram

Member
Joined
Oct 15, 2006
Messages
6
Programming Experience
5-10
Hello
I have a datagridveiw that contains 2 Columns.First column is English(Left To Right) and second column is Farsi(Right To Left).
How can i set datagridview?
Thanks
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,350
Location
Sydney, Australia
Programming Experience
10+
Please give some more detail of what you want to achieve. You don't "set" a DataGridView. Presumably you want to display some data in the grid, but where is the data coming from? If it's in a DataTable then it's usually as simple as assigning the DataTable to the DataSource property. Otherwise we'd need more information.
 

emshahram

Member
Joined
Oct 15, 2006
Messages
6
Programming Experience
5-10
This data coming from dataset.I can set RightToLeft property of Datagridview but i want set righttoleft peroperty for every column or cell separatly
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,350
Location
Sydney, Australia
Programming Experience
10+
Did you change the title of your thread or di I just completely miss the "RightToLeft" before. :confused: Anyway, that does sound like a problem that the DataGridView cannot handle by default. I'd think that you'd have to define your own column type and add that behaviour yourself. You inherit the DataGridViewTextBoxColumn and DataGridViewTextBoxCell classes and add the appropriate property and then you'd override the existing functionality that displays the text in a cell. The DataGridViewTextBoxEditingControl class inherits the TextBox class so it already has the ability to display right-to-left. Here are some links that I used to teach myself how to create my own column types. You can learn the principles from them and then adapt them to your own needs. Your case is relatively simple in the grand scheme of things.

http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx
http://www.windowsforms.net/WhidbeyFeatures/default.aspx?PageID=2&ItemID=13&Cat=Controls
 
Top Bottom