Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DataGridView text -> image

DataGridView text -> image

Scheduled Pinned Locked Moved C#
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Glen Harvy 0
    wrote on last edited by
    #1

    Hi, I have a dgv that is created programmatically and bind it to a datatable. The Columns/Cells are all text. I insert an int (as a string) into a cell when I need to and use that int to lookup another datatable when I need to. Works well :) What I would like to do is dislay an image if the cell contains an int rather than the int itself. I know I can make the columns concerned image cells and I presume I would then need to record the image name in the datatable rather than the int which is what I want. I thought of using the cell.tag to hold the int but I need that field for another purpose. I'm not even certain that is what I want because I need to store the int, not the image name. Is there someway of using the cellformating event to convert that cell into an image cell and show an image? I think it should be possible but can't find the right code. TIA,

    Glen Harvy

    M 1 Reply Last reply
    0
    • G Glen Harvy 0

      Hi, I have a dgv that is created programmatically and bind it to a datatable. The Columns/Cells are all text. I insert an int (as a string) into a cell when I need to and use that int to lookup another datatable when I need to. Works well :) What I would like to do is dislay an image if the cell contains an int rather than the int itself. I know I can make the columns concerned image cells and I presume I would then need to record the image name in the datatable rather than the int which is what I want. I thought of using the cell.tag to hold the int but I need that field for another purpose. I'm not even certain that is what I want because I need to store the int, not the image name. Is there someway of using the cellformating event to convert that cell into an image cell and show an image? I think it should be possible but can't find the right code. TIA,

      Glen Harvy

      M Offline
      M Offline
      mikailcetinkaya
      wrote on last edited by
      #2

      May use on item data bound event and create a new image cell and by downcasting paste it to the cell u want

      Mikail Çetinkaya . The C# DEveloper

      G 1 Reply Last reply
      0
      • M mikailcetinkaya

        May use on item data bound event and create a new image cell and by downcasting paste it to the cell u want

        Mikail Çetinkaya . The C# DEveloper

        G Offline
        G Offline
        Glen Harvy 0
        wrote on last edited by
        #3

        Any chance of you speaking in C#? :) I would really appreciate a code snippet. Thanks.

        Glen Harvy

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups