C# WindowsForms - Radio button comment/uncomment content of textbox keypress, textchanged and focusleave -


i have 3 radio buttons:

rbtpercentualmedioanual rbtpercentualmensal rbtvalorfixo 

i change options events textbox1 according choosed option

if chose rbtvalorfixo, uncomment:

private void textbox1_textchanged(object sender, eventargs e) {     //substituipontovirgula_textbox(sender textbox, e); }  private void textbox1_leave(object sender, eventargs e) {     //formatamoeda_textbox(sender textbox, e); } private void textbox1_keypress(object sender, keypresseventargs e) {     //numeropontoouvirgula_textbox(sender textbox, e);     formatarporcentagem_textbox(sender textbox, e); } 

and comment

private void textbox1_keypress(object sender, keypresseventargs e)     {         numeropontoouvirgula_textbox(sender textbox, e);         //formatarporcentagem_textbox(sender textbox, e);     } 

if choose option rbtpercentualmedioanual or rbtpercentualmensal, comment:

private void textbox1_textchanged(object sender, eventargs e) {     substituipontovirgula_textbox(sender textbox, e); }  private void textbox1_leave(object sender, eventargs e) {     formatamoeda_textbox(sender textbox, e); } private void textbox1_keypress(object sender, keypresseventargs e) {     numeropontoouvirgula_textbox(sender textbox, e);     //formatarporcentagem_textbox(sender textbox, e); } 

and uncomment: formatarporcentagem_textbox

private void textbox1_keypress(object sender, keypresseventargs e) {     //numeropontoouvirgula_textbox(sender textbox, e);     //formatarporcentagem_textbox(sender textbox, e); } 

i dont know how comment/uncomment keypress, textchanged or focusleave event using radiobutton check, how, not need make all, can it, have know if possible , if is, how ?

thanks

you can determine if radiobutton or checkbox checked radiobutton.checked property.

in case this:

private void textbox1_textchanged(object sender, eventargs e) {     if(!rbtvalorfixo.checked)       substituipontovirgula_textbox(sender textbox, e); } 

or:

private void textbox1_keypress(object sender, keypresseventargs e) {     if(rbtvalorfixo.checked)       numeropontoouvirgula_textbox(sender textbox, e);     else       formatarporcentagem_textbox(sender textbox, e); } 

and on.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -