c# - Multiply value from textbox with combobox and display in label in WPF -


i'm pretty new programming in wpf xaml , c# , i've searched forum similar problem, couldn't find solution problem.

i've made combobox of 3 items, each item has text content. when 1 of these items selected, want multiply value in textbox number , display result in label. here code:

public mainwindow()     {         initializecomponent();         int = int32.parse(weight.text);         double b;          if (this.wcf.selecteditem==weighing)         {             b = * 1.03;             wll.content = b.tostring();         }         else if (this.wcf.selecteditem == uptodate)         {             b = * 1.1;             wll.content = b.tostring();         }         else if (this.wcf.selecteditem == lessupdated)         {             b = * 1.2;             wll.content = b.tostring();         }      } 

"weight" name of textbox, "wcf" name of combobox, "weighing", "uptodate" , "lessupdated" name of combobox items , "wll" name of label. these defined in xaml in main window.

you'll need event handler combobox. like:

<combobox x:name="wcf" selectionchanged="cb_selectionchanged">[...]</combobox> 

in code behind:

private void cb_selectionchanged(object sender, routedeventargs e) { ... } 

the method cb_selectionchanged called each time click on item.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -