how use roscolor() ignore value (like empty cell) ? color row if value upper 5 when there nothing in cell, want ignore roscolor() apply, how? public sub roscolor() integer = 0 quotedatagridview1.rows.count() - 1 step +1 dim val integer val = quotedatagridview1.rows(i).cells(3).value if val = vbempty quotedatagridview1.rows(i).defaultcellstyle.backcolor = color.white elseif val < 5 quotedatagridview1.rows(i).defaultcellstyle.backcolor = color.red elseif val > 5 , val < 10 quotedatagridview1.rows(i).defaultcellstyle.backcolor = color.lightyellow end if next end sub you can check empty value following public sub roscolor() integer = 0 quotedatagridview1.rows.count() - 1 step +1 dim val = quotedatagridview1.rows(i).cells(3).value if isdbnull(val) or val nothing quotedatagridview1.rows(i).defaultcellstyle.backcolor = color.white ...
i create function initializes vector or array of size width * height , creates border around these values. the values around outside need initialized different value ones in center. the objects storing not have default constructor, cannot rely on initialization. this code have far, feels there should simpler or more idiomatic way of doing this. i can use features , including c++1z. #include <iostream> #include <vector> void fill_values(const unsigned width, const unsigned height, std::vector<int> &values) { for(unsigned y=0; y<height+2; ++y) { for(unsigned x=0; x<width+2; ++x) { if(x==0 || x==width+1 || y==0 || y==height+1) { values.push_back(1); } else { values.push_back(0); } } } } int main(int argc, char *argv[]) { const unsigned width = 4; const unsigned height = 3; std::vector<int> values; fill_values(width, height, values);...
Comments
Post a Comment