Results 1 to 3 of 3

Thread: DatagridTextbox behaviour

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304

    DatagridTextbox behaviour

    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.

  2. #2
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279
    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?
    A cynic knows the price of everything but the value of nothing.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width