Can you highlight using a style within a listbox

I am populating a weblistbox with a search term from a webtextfield, the first five columns are the returned fields, and they fill cells 0-4. In cell five is the ‘searched field’ I would like to highlight the search term among the returned value, some pseudo code for this below, I only get and added (i would like to use a highlight of a yellow background webstyle but thought I would start with bold on the off-chance it may work straight off). It didn’t LOL :slight_smile:

Is it possible, if so how?

ps=instr(0,,txtSearch.text) 'gives start of highlight fronttext=left(,ps-1) backtext=mid(,ps+len(txtSearch.text)) disp=fronttext+"<b>"+txtSearch.text+"</b>"+backtext Listbox1.Cell(Listbox1.LastIndex, i-1 ) = disp

Listbox1.CellBold(Listbox1.LastIndex, i-1 ) = true

but it will only be possible to make bold the entire cell, not a part of it

if you want to bold a part of the cell text, you must use the event cellbackgroundpaint and draw the text yourself using drawstring.

Thanks Jean-Yves, as all cells contain the the searched text somewhere highlighting the whole cell is a bit pointnless but i’ll take a look at drawstring and see what i can come up with.