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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Making one cell in a DataGrid bold

Making one cell in a DataGrid bold

Scheduled Pinned Locked Moved Visual Basic
salesquestion
2 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.
  • C Offline
    C Offline
    ColdWaterBlue
    wrote on last edited by
    #1

    I am trying to make one cell in a DataGrid bold based on it's value (i.e. If a customer's number of orders is greater than ten, bold the orders field for that customer). I read somewhere that the key to doing this is through the DataGridColumnStyles but I can't seem to find anything there for this. Does anybody know how this gets done? You think you know everything I'll show you what everyone else can see It's too late to change anything What's here is all that we need to be!

    P 1 Reply Last reply
    0
    • C ColdWaterBlue

      I am trying to make one cell in a DataGrid bold based on it's value (i.e. If a customer's number of orders is greater than ten, bold the orders field for that customer). I read somewhere that the key to doing this is through the DataGridColumnStyles but I can't seem to find anything there for this. Does anybody know how this gets done? You think you know everything I'll show you what everyone else can see It's too late to change anything What's here is all that we need to be!

      P Offline
      P Offline
      partt
      wrote on last edited by
      #2

      Private Sub myDataGrid_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles myDataGrid.ItemDataBound If CType(e.Item.Cells(2).Text, Integer) > 10 Then e.Item.Cells(2).ForeColor = Color.Red End If End Sub You can put in something like this. A datagrid is zero-based, so this(cells(2)) would be the third column from the left. Have Fun!

      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