c# - ListView check for max chat limit tresspassing -


is there anyway can auto check character limit in listview, changing background color orange or other color item violating limit?

this goes in event of imported text; after importing, loops through items , checks if items violate limit. if do, should coral background color, it's not working.

for (int = 0; < numpntr; i++) {     int charlim = encoding.utf8.getbytecount(listview1.items[i].subitems[1].text);      if (charlim > bytecnt)     {         listview1.items[i].backcolor = color.coral;     } } 

change line:

int charlim = encoding.utf8.getbytecount(listview1.items[i].subitems[1].text); 

to:

int charlim = encoding.utf8.getbytecount(listview1.items[i].text); 

it's work me.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -