hi... I've made VB application in VS2010 that uses a 2010 Access database it was working fine but when install the application on Windows 7 Ihad problems , I am using a datagridview and groupbox but when I try to change the colors and try to resize the screen on the device size I can't ...
image attached & code ...
image attached & code ...
Code:
Public Sub color_rows()
Dim status As String
For i = 0 To DataGridView1.Rows.Count - 1
Try
Dim cmd As String = "SELECT status FROM status_time where id in (select max(id) from status_time where mrn = " & DataGridView1.Rows(i).Cells(0).Value & ")"
Dim connection As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\database.accdb")
Dim dataadapter As New OleDb.OleDbDataAdapter(cmd, connection)
Dim ds As New DataSet()
connection.Open()
dataadapter.Fill(ds, "status_time")
connection.Close()
Dim dv As DataView
dv = New DataView(ds.Tables(0), "", "", DataViewRowState.CurrentRows)
status = ds.Tables(0).Rows(0).Item(0)
Select Case status
Case "Arrived"
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.Red
Case "On Going"
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.DarkViolet
Case "No show"
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.Orange
Case "Completed"
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.LimeGreen
Case "Coming"
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.Yellow
Case "Reschedule"
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.Violet
Case "Cancelled"
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.DarkGray
Case Else
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.White
End Select
Catch ex As Exception
DataGridView1.Rows(i).Cells(1).Style.BackColor = Color.White
End Try
Next
If DataGridView1.Rows.Count > 0 Then
DataGridView1.CurrentRow.Selected = False
End If
End Sub