Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

colouring datagrid

Status
Not open for further replies.

SqlHunter

Programmer
Jun 3, 2004
166
US
This code is to display record set in a data grid

Dim sql_status As String
sql_status = "Select active_id,refer_id,process_name,process_type,process_start_date, process_end_date from tbl_active_log where refer_id = '" & txt_refer.Text & "' order by active_id"

Here I pass the string to the display_data_grid and then it gives all the records for the query

Public Sub display_data_grid(Adodc_RecordSource_Sql As String)
grd_loan_details.Refresh
Adodc1.ConnectionString = Connect2Sourcedb.conn
Adodc1.CursorLocation = adUseClient
Adodc1.LockType = adLockOptimistic
Adodc1.CursorType = adOpenDynamic
Adodc1.RecordSource = Adodc_RecordSource_Sql
grd_loan_details.Refresh
Adodc1.Refresh
txt_Record_Count = Adodc1.Recordset.RecordCount
Set grd_loan_details.DataSource = Adodc1
grd_loan_details.Refresh
Adodc1.Refresh
End Sub

No my issue is I need to color yellow on the lastest active_id row in the grid.Please help me with the code.Thanks

 
Read faq222-2244 to see why you shouldn't 'bump', and to see how to get the best from the forum.

Using a Flexgrid instead of a Datagrid will make the job much easier. In a FG you have the CellBackColor property:

fg1.Row = 2
For i = 0 To fg1.Cols - 1
fg1.Col = i
fg1.CellBackColor = vbYellow
Next i


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
or without the loop by selecting a range of cells,
Code:
fg1.row=2
fg1.rowsel=2
fg1.col=0
fg1.colsel=fg1.cols-1
fg1.fillstyle=flexfillrepeat
fg1.CellBackColor = vbYellow


zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top