vb.net - Apply multiple FontStyles to Richtextbox -



vb.net - Apply multiple FontStyles to Richtextbox -

i need help figure out how set bold,italic,underline same text richtextbox.. far have been doing this...

public class form1 dim texto string public sub seleccioncb() if cbnegrita.checked = true txttexto.font = new font(txttexto.font, fontstyle.bold) else txttexto.font = new font(txttexto.font, fontstyle.regular) if cbcursiva.checked = true txttexto.font = new font(txttexto.font, fontstyle.italic) else txttexto.font = new font(txttexto.font, fontstyle.regular) if cbsub.checked = true txttexto.font = new font(txttexto.font, fontstyle.underline) else txttexto.font = new font(txttexto.font, fontstyle.regular) end if end if end if end sub

you can combine multiple values using bitwise or operator, instance:

txttexto.font = new font(txttexto.font, fontstyle.bold or fontstyle.italic)

however, in case, need check each 1 condition, can this:

dim style fontstyle = fontstyle.regular if cbnegrita.checked style = style or fontstyle.bold if cbcursiva.checked style = style or fontstyle.italic if cbsub.checked style = style or fontstyle.underline txttexto.font = new font(txttexto.font, style)

vb.net visual-studio

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -