datagridview cell formatting after data has been loaded from database -
please help!! i've spent 4 hours trying figure out , haven't been able make work. cannot format of datagridview cells after loading data access db. program runs , returns no errors, no satisfactory results. need format "description" red color there's no "numero"
try con.open() da.fill(dt) con.close() dgvmain.datasource = dt dgvmain .columns("key").visible = false .columns("masterid").visible = false .columns("numero").headertext = "#" .columns("numero").defaultcellstyle.alignment = datagridviewcontentalignment.middleright .columns("numero").sortmode = datagridviewcolumnsortmode.notsortable .columns("numero").width = 40 .columns("addemdum").visible = false .columns("opens").visible = false .columns("description").defaultcellstyle.alignment = datagridviewcontentalignment.middleleft .columns("description").sortmode = datagridviewcolumnsortmode.notsortable .columns("description").width = 710 .columns("sortnumber").visible = false .columns("remarks").headertext = "" .columns("remarks").sortmode = datagridviewcolumnsortmode.notsortable .columns("remarks").width = 30 .columns("remarks").defaultcellstyle.forecolor = color.red .columns("remarks").defaultcellstyle.font = new font("arial black", 9) .columns("remarks").defaultcellstyle.alignment = datagridviewcontentalignment.topright .columns("status").visible = false .columns("pass").visible = false .columns("fail").visible = false .columns("requires_input").visible = false .columns("input_data").visible = false .columns("gig").visible = false .columns("gignotes").visible = false .columns("inspectiontype").visible = false .columns("newitem").visible = false end catch ex exception con.close() msgbox(ex.message) exit sub end try integer = 0 dgvmain.rows.count - 1 if dgvmain.rows(i).cells("numero").value.tostring = nothing dgvmain.rows(i).cells("description").style.forecolor = color.red end if next
Comments
Post a Comment