PDA

Click to See Complete Forum and Search --> : DatagridTextbox behaviour


RichardAtherton
Apr 1st, 2002, 05:55 PM
I've created my own tablestyle and columnstyles for some data I'm both displaying and editing in a datagrid.

to format the data the way I want I've created my own DataGridTextBoxColumn and since this is numeric data I wanted to use the textalign right property, however even though I code it like this:

Dim Qty As New DataGridTextBoxColumn()
Qty.MappingName = "Qty"
Qty.HeaderText = "Qty"
Qty.TextBox.MaxLength = 3
Qty.TextBox.TextAlign = HorizontalAlignment.Right
Qty.Format() = "#0"
Qty.Width = 40
Qty.NullText = ""
ts1.GridColumnStyles.Add(Qty)
DataGrid1.TableStyles.Add(ts1)

the insert cursor stubbornly styays on the left!!! not the right as I wnanted

can anyone see anything wrong with my coding, I know the datagridtextbox inherits from the textbox and it's exactly the same property I use for a textbox and that works fine.

Dman
Apr 4th, 2002, 02:27 PM
Have you had any experience with creating datagridtextboxcolumns on the fly? I want to set properties for the datagridtextboxcolumns in a datagrid by setting up a kind of "control array" and looping through them to cut down on numerous blocks of what you posted as your example. I have a similar situation but I'm pulling all my headertext and mapping info from a web service and want to populate these properties for each datagridtextboxcolumns as it comes in. Any suggestions?

RichardAtherton
Apr 5th, 2002, 08:23 AM
No I haven't is the short answer, but I do know that that DataGridColumns are held in a collection, which you can obviously cycle through and then I guess have a matching array with the properties you want to set and use the index of the collection to match the entry in the array, I don't know this will work but at least it's a line of research to look into