Results 1 to 2 of 2

Thread: Datagrid -> still no solution

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2004
    Posts
    48

    Datagrid -> still no solution

    Dear Programmer,

    I have been having this problem since the beginning, I am programming in VB.Net -> EXE file (NOT ASP.NET) and I'm still not able to put a image (from a imagelist) in a datagrid. Can somebody please help me, this is irritating me :S

    DATAGRID example:
    ----------------------------------------------------------------
    1 ___ OK _______ Imagelist1.PictureOK.jpg
    2 ___ NOT OK ___ Imagelist1.PictureNotOK.jpg
    ----------------------------------------------------------------

  2. #2
    Junior Member
    Join Date
    Jun 2004
    Posts
    29

    Smile Its is for the Windows gird not the Asp.net grid

    I just tried out the code it works at my end. You can refer to the following code:

    DataGridTableStyle DGStyle;
    DataGridColumnStyle GridTextColumn, GridBmpColumn;
    DGStyle = new DataGridTableStyle();

    // select table
    DGStyle.MappingName = "Test";

    // get the PropertyDescriptorCollection for the data
    // source and data member.
    PropertyDescriptorCollection pcol =
    this.BindingContext[DBDataSet,
    "Test"].GetItemProperties();

    // create column style for a text column
    GridTextColumn = new DataGridTextBoxColumn(pcol["Description"]);
    GridTextColumn.MappingName = "Description";
    GridTextColumn.HeaderText = "Icon-Name";
    GridTextColumn.Width = 200;
    DGStyle.GridColumnStyles.Add(GridTextColumn);

    // create column style for an image column
    GridBmpColumn = new DataGridImageColumn(pcol["Images"]);
    GridBmpColumn.MappingName = "Images";
    GridBmpColumn.HeaderText = "Bitmap";
    GridBmpColumn.Width = 100;
    DGStyle.GridColumnStyles.Add(GridBmpColumn);

    // add table style to the data grid
    dataGrid1.TableStyles.Add(DGStyle);

    // connect grid with database
    dataGrid1.DataSource = DBDataSet;
    dataGrid1.DataMember = DBDataSet.Tables["Test"].TableName;


    Above code can be tried if you want to download the version from the site you can refer to the following link:

    http://www.codeguru.com/Csharp/Cshar...cle.php/c4783/
    Give me a place to stand and I will move the Earth

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