Results 1 to 2 of 2

Thread: Datagrid Issues

Threaded View

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    Lightbulb Datagrid Issues

    ok the example show below is too hard for me to follow

    All i wana do is add some background colours depending on external information from a db so if for example row 1 has a status of 1 then its background colour is red

    my code show here (without background colours)
    ==========================================
    ' The DataSet that holds the data.
    Private m_DataSet1 As DataSet, m_DataSet2 As DataSet

    ' Load the data.


    Private Sub frmTrackingManager(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'Dim objDg As clsDataGrids = New clsDataGrids
    'objDg.DoDataGrids("SELECT * FROM casesInProgress ORDER BY Fullname")
    'DataGrid1.DataSource = objDg.m_DataSetr
    Dim data_adapter1, data_adapter2 As SqlDataAdapter

    Dim strSql1 As String = "SELECT fullname,customerId, building + space(1) + street FROM casesInProgress WHERE Status = 1 ORDER BY Fullname"
    Dim strSql2 As String = "SELECT fullname,customerId, building + space(1) + street FROM casesInProgress WHERE status > 1 ORDER BY Fullname"

    data_adapter1 = New SqlDataAdapter(strSql1, MyConnection) ' Create the SqlDataAdapter.
    data_adapter2 = New SqlDataAdapter(strSql2, MyConnection) ' Create the SqlDataAdapter.

    data_adapter1.TableMappings.Add("Table", "casesInProgress")
    data_adapter2.TableMappings.Add("Table", "casesInProgress") ' Map Table to Contacts.
    m_DataSet1 = New DataSet ' Fill the DataSet.
    m_DataSet2 = New DataSet
    data_adapter1.Fill(m_DataSet1)
    data_adapter2.Fill(m_DataSet2)


    'doDGFill("SELECT fullname,customerId, building, street FROM casesInProgress WHERE Status = 1 ORDER BY Fullname")
    DataGrid1.DataSource = m_DataSet1.Tables("casesInProgress") ' Bind the DataGrid control to the Contacts DataTable.
    DataGrid1.CaptionText = "New applications awaiting lender ref"
    DataGrid1.ReadOnly = True

    'doDGFill("SELECT fullname,customerId, building, street FROM casesInProgress WHERE status > 1 ORDER BY Fullname")
    DataGrid2.DataSource = m_DataSet2.Tables("casesInProgress") ' Bind the DataGrid control to the Contacts DataTable.
    DataGrid2.CaptionText = "Applications with a lender ref"
    DataGrid2.ReadOnly = True
    End Sub




    Private Sub dgContacts_Navigate(ByVal sender As System.Object, ByVal ne As System.EventArgs) Handles DataGrid1.DoubleClick
    Dim dv As DataView = m_DataSet1.Tables("CasesInProgress").DefaultView
    m_intRecordId = dv.Item(DataGrid1.CurrentRowIndex)("CustomerId")
    'MsgBox(dv.Item(DataGrid1.CurrentRowIndex)("CustomerId"))
    Dim parent As MainApplication = CType(Me.MdiParent, MainApplication)
    parent.ShowSingleInstance(GetType(frmCustomerAccount), 0)
    End Sub
    Last edited by carlblanchard; Oct 22nd, 2003 at 04:19 AM.
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

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