formating datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonas Knaus

    #1

    formating datagrid

    hi there...

    i fill my datagrid with a DataTable :

    DataTable DA = new DataTable();
    sqlDA.Fill(DA);
    dataGridAdresse .DataSource = DA;

    now i would like to formate my datagrid but i don't know how to use
    tableStyle with DataTable.
    who do i set the width of a certain column ??
    is there anyone who could help me or provide me some example ???

    thank you very much !!!

    jonas knaus

    jonas.knaus@nav iti.ch


  • Tracey

    #2
    formating datagrid

    Can you read vb.net code? Here is an example.
    Suppose you have a datatable.

    Dim DA as datatable = new dataTable("MyTa ble")
    //Suppose you have two column in DA, say "No" and "Name"

    Dim tbs as DatagridTableSt yle
    tbs.mappingName = "MyTable"
    tbs.gridlinecol or = system.drawing. color.lightgray
    //....you can set other attribute here.

    Dim tbc1 as new datagridtextbox column()
    tbc1.MappingNam e = "No"
    tbc1.width = 40
    tbs.gridstyles. add(tbc1)

    Dim tbc2 as new datagridTextbox Column()
    tbc2.MappingNam e ="Name"
    tbc2.width = 50
    tbs.gridstyles. add(tbc2)


    dataGridAdresse .DataSource = nothing
    datagridAdresse .tablestyles.ad d(tbs)
    dataGridAdresse .DataSource =DA



    Hope it helps.
    Tracey
    [color=blue]
    >-----Original Message-----
    >hi there...[/color]
    i fill my datagrid with a DataTable :
    DataTable DA = new DataTable();
    sqlDA.Fill(DA);
    dataGridAdresse .DataSource = DA;

    now i would like to formate my datagrid but i don't know
    how to use tableStyle with DataTable. who do i set the
    width of a certain column ??[color=blue]
    >is there anyone who could help me or provide me some[/color]
    example ???[color=blue]
    >
    >thank you very much !!!
    >
    >jonas knaus
    >
    >jonas.knaus@na viti.ch
    >
    >
    >.
    >[/color]

    Comment

    • Tobin Harris

      #3
      Re: formating datagrid


      "Jonas Knaus" <jonas_knaus@ho tmail.com> wrote in message
      news:O08Cxj7eDH A.2172@TK2MSFTN GP09.phx.gbl...[color=blue]
      > who do i set the width of a certain column ??
      > is there anyone who could help me or provide me some example ???[/color]

      Hi there,

      I've been playing with this, but haven't got it totally right yet. I wrote a
      class called the DataGridColumnS izer that may give you a good starting
      point. It's available from here:



      An example of the key code for setting column widths is as follows:

      inGrid.TableSty les[0].GridColumnStyl es[0].Width = 10

      This would set the width of the first table, first column to 10

      HTH

      Tobin
      [color=blue]
      > thank you very much !!!
      >
      > jonas knaus
      >
      > jonas.knaus@nav iti.ch
      >
      >[/color]


      Comment

      • Jonas Knaus

        #4
        Re: formating datagrid

        hi all

        thanks for your help
        jonas


        "Tobin Harris" <tobin_dont_you _spam_me@breath email.net> schrieb im
        Newsbeitrag news:bk5589$oq6 lk$1@ID-135366.news.uni-berlin.de...[color=blue]
        >
        > "Jonas Knaus" <jonas_knaus@ho tmail.com> wrote in message
        > news:O08Cxj7eDH A.2172@TK2MSFTN GP09.phx.gbl...[color=green]
        > > who do i set the width of a certain column ??
        > > is there anyone who could help me or provide me some example ???[/color]
        >
        > Hi there,
        >
        > I've been playing with this, but haven't got it totally right yet. I wrote[/color]
        a[color=blue]
        > class called the DataGridColumnS izer that may give you a good starting
        > point. It's available from here:
        >
        > http://www.tobinharris.com/default.asp?id=11&mnu=11
        >
        > An example of the key code for setting column widths is as follows:
        >
        > inGrid.TableSty les[0].GridColumnStyl es[0].Width = 10
        >
        > This would set the width of the first table, first column to 10
        >
        > HTH
        >
        > Tobin
        >[color=green]
        > > thank you very much !!!
        > >
        > > jonas knaus
        > >
        > > jonas.knaus@nav iti.ch
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...