I am using .NETCF version 2.0. I would appreciate any help I can get. This should be a simple task and is indeed simple in full .NET, and I cannot believe MS eliminated cell/column text alignment in CF.
Main Topics
Browse All TopicsI can set header alignment in .NET CF, but I cannot find any documentation or examples of how to set text alignment for a data column (not the header). I would greatly appreciate an example of how to do this. Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
It appears that the Compact Framework System.Windows.Forms.DataG
I found this article, that references a sample custom DataGrid that provides an Alignment property for the column styles:
.Net Compact Framework V2 Service Pack 1 Data Grid control enhancements.
http://blogs.
"
Download the sample from this link pointed to by the "here" link:
http://blogs.msdn.com
I did download the file, but I see that it is a .msi file. I don't want to install the sample app, I need to see the sample code as to how to do an Alignment property.
I did find another links http://www.ehartwell.com/I
and http://blog.quayinc.com/20
that show an Alignment property for a CF Datagrid, but when I try the code construct they don't work. Both examples are C# leading me to believe the all .NET languages are not created equal.
Curious. System.Windows.Forms.DataG
I do have a reference to System.Windows.Forms as you can see in the attached list, and I still have the error noted in my CustCol2 image above. Does it need to reference the 2.0 version of System.Windows.Forms.DataG
Hang in there. You obviously know way more about this that I.
Hmmm...my thinking gets stuck in the regular Windows Forms world. The Smart Device project doesn't allow you to change the target framework.
How to install and USE .net Compact Framework 3.5 WITHOUT upgrading your ROM.
http://www.modaco.com/cont
You right-clicked on the solution in the Solution Explorer, and not the project. You can tell that by noticing the multiple project contexts listed for the entire solution.
The link seems to deal with upgrading the smart device to 3.5. My app is already at 3.5 and deploys and works fine. If I attempt to add the 2.0 reference to System.Windows.Forms.DataG
Is there some way to upgrade the C# project to 3.5? I tried the Project Upgrade selection and it didn't change any of the references.
I created a new Pocket PC 2003 for .NET 3.5 Class Library project, and then added the code files from the 2.0 project, and added a reference to the System.Windows.Forms.dll and System.Drawing.dll to get a project. I upload the file to the Experts-Exchange system, so that you can download.
http://www.ee-stuff.com/Ex
The reference was a case of 'monkey see, monkey do'. I was including the DataGridCustomColumns project in with mine. I have now realized that I should just create the .dll and reference it - must be getting senile. Anyway, all of the fatal errors seemed to disappear upon restarting the DE this morning. The only thing remaining was to get the reference correct, which has now been done with the .dll creation and added reference to it.
Now my app has no errors and calls the appropriate C# code correctly, but there must be something strange with the C# code. Take a look at the two attached images - one shows a grid without using the DataGridCustomColumns Alignment and the other one with the Alignment. The latter seems to be dropping my data.
Any ideas?
As you can see I only used the new Custom style for column 4, and that in this snippet I have commented out the previous instatiation code for tcol4.
Dim ts As DataGridTableStyle = New DataGridTableStyle()
Dim tcol0 As New DataGridTextBoxColumn
Dim tcol1 As New DataGridTextBoxColumn
Dim tcol2 As New DataGridTextBoxColumn
Dim tcol3 As New DataGridTextBoxColumn
' Dim tcol4 As New DataGridTextBoxColumn
Dim tcol4 As New DataGridCustomTextBoxColum
ts.MappingName = "RSFreight"
tcol0.MappingName = "RecID"
tcol0.Width = 0
ts.GridColumnStyles.Add(tc
tcol1.MappingName = "RecHdrID"
tcol1.Width = 0
ts.GridColumnStyles.Add(tc
tcol2.MappingName = "RecChgType"
tcol2.Width = 150
tcol2.HeaderText = "Description"
ts.GridColumnStyles.Add(tc
tcol3.MappingName = "RecGLPostCd"
tcol3.Width = 0
ts.GridColumnStyles.Add(tc
With tcol4
.Owner = Me.grdFreight
.MappingName = "RecAmount"
.Width = 70
.HeaderText = "Amount"
.Format = "F2"
.Alignment = HorizontalAlignment.Right
End With
ts.GridColumnStyles.Add(tc
grdFreight.TableStyles.Add
Business Accounts
Answer for Membership
by: TheLearnedOnePosted on 2009-08-20 at 05:32:07ID: 25141582
While I don't know the specific answer, I would be interested to know (and help find) the answer. It might help to know what Compact Framework version you are using.