vb.net - one sub procedure / change text color in rich text box / without button handler -


everyone! i've been @ while, , i'm not sure how issue can resolved:

i'm working on project in vb.net, , have form rich text box. have groupbox 4 radio buttons inside intended change font color of text. coincidentally, have repeat same functionality 2nd set of radio buttons change text font family.

at rate i've been able following change font color of whatever text highlight in rich text box:

private sub rbtnblack_checkedchanged(byval sender system.object, byval e system.eventargs) handles rbtnblack.checkedchanged     rtbxtexteditor.selectioncolor = color.black end sub  private sub rbtnred_checkedchanged(byval sender system.object, byval e system.eventargs) handles rbtnred.checkedchanged     rtbxtexteditor.selectioncolor = color.crimson end sub  private sub rbtngreen_checkedchanged(byval sender system.object, byval e system.eventargs) handles rbtngreen.checkedchanged     rtbxtexteditor.selectioncolor = color.darkgreen end sub  private sub rbtnblue_checkedchanged(byval sender system.object, byval e system.eventargs) handles rbtnblue.checkedchanged     rtbxtexteditor.selectioncolor = color.royalblue end sub 

is there way write sub (i'm assuming use sub, since don't think need return anything, eliminating use of function) handle action of changing selected text color in rich text box without having use separate sub each radio button? mind you, per teacher's specs, doesn't use button handler of this.

thanks, , please let me know if i've supplied enough information!

something work:

private sub somethingchanged(byval sender system.object, byval e system.eventargs)  handles rbtnblack.checkedchanged,rbtnred.checkedchanged,rbtngreen.checkedchanged ' etc ...   if sender = rbtnblack     rtbxtexteditor.selectioncolor = color.black   end if    if sender = rbtnred     rtbxtexteditor.selectioncolor = color.crimson   end if    ' etc  end sub 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -