none
(Sumber: milist DOTNET) Hierarchical data grid RRS feed

  • Pertanyaan

  • dear all,...

    saya dah ngubek2, nyari2 gmana caranya bikin hirearcial COA (chart of account) di datagrid, belum ketemu2, ada link atw adakah yang sudah pernah mengerjakannya 

    misal : 

    Perkiraan                                            

    ---------------------------------------------------------

    100-00 Bank 

           100-01 BCA lembang    

            100-02 BCA Surabaya 

    atau

    Kode Akun                     Uraian

    ---------------------------------------------------------

    10100                            BANK

    10101                                  BCA lembang

    10102                                  BCA Surabaya

    jadi bisa berjenjang (level) di data grid view


    Agnes Sannie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Jumat, 27 April 2012 10.14
    Moderator

Jawaban

  • cukup di format tampilannya kira-kira seperti ini:

    this.dataGridView1.CellFormatting += (s, e) =>

    {

    var accountNameColumn = this.dataGridView1.Columns["YourTargetColumnName"];

    if (accountNameColumn == null ||

    e.ColumnIndex != accountNameColumn.Index)

    {

    return;

    }

    // you can make column or using logic to indentifier is this column need to reformat.

    var indent =

    (Int16)this.dataGridView1

    .Rows[e.RowIndex]

    .Cells["YourIndentValueColumn"]

    .Value;

    if (indent == 0) return;

    e.Value =

    String.Format(

    "{0}{1}",

    new String(' ', indent * 3),

    e.Value);

    e.FormattingApplied = true;

    };

    Dijawab oleh: dede


    Agnes Sannie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Jumat, 27 April 2012 10.15
    Moderator