0
我已將數據從數據庫加載到datagridview,並具有兩列目標值和卷,其中Item單元> Item最小值表示卷單元應呈綠色,項目最小值<項目單元那麼音量應該是紅色。我嘗試過但我無法做到。在條件vb.net上更改datagridview行顏色
進口System.Data.SqlClient的
公共類view_all
Dim con1 As SqlConnection
Dim con As String
Dim da As SqlDataAdapter
Dim ds As DataSet
Private Sub view_all_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim obj As New config
con1 = New SqlConnection
con1 = obj.getcontion()
con1.Open()
da = New SqlDataAdapter("select * from item", con1)
ds = New DataSet
da.Fill(ds, "item")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "item"
DataGridView1.Columns(0).HeaderText = "Item Id"
DataGridView1.Columns(1).HeaderText = "Item Name"
DataGridView1.Columns(2).HeaderText = "Item Number"
DataGridView1.Columns(3).HeaderText = "Item Propose"
DataGridView1.Columns(4).HeaderText = "Item Unit "
DataGridView1.Columns(5).HeaderText = "Item Max"
DataGridView1.Columns(6).HeaderText = "Item min"
End Sub