
يامبراطور حاولت اجربها من باب الفائدة لكن مازبطت وكتبت الكود كالتالي لل "+" ,
public class form1
dim a, b, c as double
private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click
a = val(textbox1.text)
label1.text = "+"
وياليت تكمل طريقة ال "=" لان الظاهر الخلل لعدم وجودها .
جرب هالكود مانت بحاجة الا ل 1 تست بوكس وواحد بوتون ثم اضغط ع البوتون وحط هالكود
private sub button1_click(byval sender as system.object, byval e as system.eventargs) handles button1.click
dim x as integer
x = instr(textbox1.text, "+", comparemethod.text)
if x > 0 then myoperation("+")
x = instr(textbox1.text, "-", comparemethod.text)
if x > 0 then myoperation("-")
x = instr(textbox1.text, "*", comparemethod.text)
if x > 0 then myoperation("*")
x = instr(textbox1.text, "/", comparemethod.text)
if x > 0 then myoperation("/")
end sub
private sub myoperation(byval myassign as string)
dim stt() as string
stt = split(textbox1.text, myassign)
dim a, b as double
a = stt(0) 'cdbl()
b = stt(1) 'cdbl()
if myassign = "+" then textbox1.text = a + b 'cstr()
if myassign = "-" then textbox1.text = a - b 'cstr()
if myassign = "*" then textbox1.text = a * b 'cstr()
if myassign = "/" then textbox1.text = a / b 'cstr()
end sub
الكود عمله بيكون انك تحط اي عملية بالتست بوكس (1+1) وتضغط البوتون يطلع الناتج .