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. Visual Basic
  4. Datagrid, DataSet

Datagrid, DataSet

Scheduled Pinned Locked Moved Visual Basic
databasedockertutorialquestionannouncement
1 Posts 1 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.
  • D Offline
    D Offline
    dannygilbert3
    wrote on last edited by
    #1

    Hi folks ! In the present code, we use a datagrid as a container to print data from a SQL database. The following gets data (via ODBC) in the SQL database and save it in a DATASET. Public Function GetDatasetGiveSql(ByVal sqlCmd As String) As DataSet Dim dataset As New DataSet odbcCmd.Connection.Close() odbcCmd = New Odbc.OdbcCommand(sqlCmd, odbcConnection) odbcAdapt = New Odbc.OdbcDataAdapter(odbcCmd) odbcCmd.Connection.Open() odbcAdapt.Fill(dataset) Return dataset End Function Elsewhere in the software, the software builds a query and sends it to the database like this: dsCommand = sql.GetDatasetGiveSql(cmd) DataGridCommand.SetDataBinding(dsCommand, "Table") As you can suspect, dsCommand is a DataSet and DataGridCommand is the DataGrid to update. Easy to date… OK. Question: --------- I want to have control on the background and foreground color of a cell based on some information like any people in this forum. I found many EXAMPLES with DataGridColumnStyle where the idea is to override the Paint method (aka: make a custom datagrid control). Yes, Perfect. I understand it BUT in this case… I DON’T CONTROL ANY COLUMN in the datagrid. It seems that the SetDataBinding() does everything by itself, it is magic. I did not find HOW to OVERRIDE the Paint() method of this datagrid. Maybe I don’t understand something ! :^) Danny Gilbert, enginneer Montréal, Canada -- modified at 13:44 Wednesday 19th April, 2006

    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