Hello, everyone! I've been at this for a while, and I'm not sure how this issue can be resolved:
I'm working on a project in VB.Net, and I have a form with a rich text box. I have a groupbox with 4 radio buttons inside that are intended to change the font color of the text. Coincidentally, I have to repeat this same functionality for a 2nd set of radio buttons that would change the text font family.
At any rate what I've only been able to do is the following to successfully change the font color of whatever text I highlight in the rich text box:
Private Sub rbtnBlack_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnBlack.CheckedChanged
rtbxTextEditor.SelectionColor = Color.Black
End Sub
Private Sub rbtnRed_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnRed.CheckedChanged
rtbxTextEditor.SelectionColor = Color.Crimson
End Sub
Private Sub rbtnGreen_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnGreen.CheckedChanged
rtbxTextEditor.SelectionColor = Color.DarkGreen
End Sub
Private Sub rbtnBlue_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnBlue.CheckedChanged
rtbxTextEditor.SelectionColor = Color.RoyalBlue
End Sub
Is there a way that I could write a sub (I'm assuming I would use a sub, since I don't think I need to return anything, thus eliminating the use of a function) that would handle the action of changing the selected text color in the rich text box without having to use a separate sub for each radio button? Mind you, per my teacher's specs, she doesn't use a button handler for any of this.
Thanks, and please let me know if I've supplied enough information!