c# - How to divide a string value by another string value, each containing a numeric value -


how make label display numericupdown1 / numericupdown2 properly?

here have

label6.text = convert.tostring(numericupdown1.value/numericupdown2.value); 

i have tried

label6.text = numericupdown1.value/numericupdown2.value 

and got error saying

cannot implicitly convery blah blah bytes

an after start project crashes ( have project opens tries display numud1 / numud2 ...

in simple terms:

decimal d = (numericupdown1.value/numericupdown2.value);  stringval = system.convert.tostring(d);  label6.text = stringval; 

or create subclass of numericupdown , override parsevalue method (as seen here):

public class mynumericupdown : numericupdown {    protected override double parsevalue(string text)   {      // change text whatever want      string newtext = fixtext(text);       // call base implementation.      base.parsevalue(newtext);   }    private static string fixtext(string inputtext) {     // stuff here.   }  } 

Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -