c# - Cannot implicitly convert type 'string' to 'System.Windows.Controls.TextBox' error when trying to square root a text box -


i trying square root text box value , output different text box. have far:

private void buttonsquareroot_click(object sender, routedeventargs e) {     double input1double = convert.todouble(textboxinput1.text);     double vartextboxanswer = math.sqrt(input1double);     textboxanswer = vartextboxanswer.tostring(); } 

it comes error message:

 severity   code    description project file    line    suppression state 

error cs0029 cannot implicitly convert type 'string' 'system.windows.controls.textbox' calculator c:\users\user\documents\visual studio 2017\projects\calculator\calculator\mainwindow.xaml.cs 125 active

line 125 1 starting textboxanswer

if have idea how fix please help! if haven't been specific enough please reply , give more information.

replace

textboxanswer = vartextboxanswer.tostring(); 

with

textboxanswer.text = vartextboxanswer.tostring(); 

you have write result text property of textbox object.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -