Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

How to display right most digits in datagrid column

$
0
0

I have a datagrid (not datagridview) on a windows form.  There is a requirement to display only the last four digit of a SSN and size the grid column to only allow 4 digits to be viewed.  The other requirement is to allow the user to be able to resize the grid column so the entire 9 digit SSN will be displayed.  I have tried setting the alignment to right justified but this display the first digits of the SSN.  For example, SSN 123456789 I need to display the 6789 but 1234 is what is being displayed. 

The datagrid is bound to a collection and the code for the column is below.   Does anyone know how I would get the last 4 digits displayed initially in the grid when there are 9 digit SSN.  As I said earlier the 9 digits must be there in case the users needs this data by enlarging the grid column.   I appreciate the help. 

 colSSN = New FormattableTextBoxColumn("VstId", Me.msrtBrushesList)
                With colSSN
                    .MappingName = "Ssn"
                    .HeaderText = "SSN"
                    .Width = 40
                    '.Alignment = HorizontalAlignment.Right
                    '.TextBox.TextAlign = HorizontalAlignment.Right

                End With
                Me.tsTableStyle.GridColumnStyles.Add(colSSN)


Viewing all articles
Browse latest Browse all 2535

Trending Articles