Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hiz i have a project to present in my university about an scientific calculator
I already did all numbers button , the backspace, the operation "+,-,*,/" and that by
1st dim operation as string
then in each button of those i put operation = "+" or ...
and in the equal I put if operation = "+" then a+b
i'am using 1 textbox
in the scientific operation i used txtbox.text=math.sin(txtbox.txt) 4 exemple
the only button i need right now is the breckts button
i tried to start by puttint txtbox.txt= txtbox.text & "(" and that didn't work
i need to used it to put an equation like (a+b)*c for exemple
PS i'am not studying computor programtion in uni but this a course that i have to take since i'am studying to be an math teacher so i'am new to all the coding issue
Posted
Updated 3-Feb-14 10:02am
v2
Comments
_Maxxx_ 3-Feb-14 21:42pm    
When you say "i tried to start by puttint txtbox.txt= txtbox.text & "(" and that didn't work " what didn't work exactly?
Member 10569133 4-Feb-14 16:47pm    
i mean even the breckets when clicked didnt appear while running
i tried it this as a start since the numbers i put them this way textbox.text = textbox.text & "1"
_Maxxx_ 4-Feb-14 17:38pm    
TO be clear.
textbox1.Text & "1" works, but
textbox1.Text & "(" doesn't?

And by 'works' you mean the bracket doesn't appear?
Member 10569133 5-Feb-14 6:24am    
yes i mean appear and yes the nb 1 did appear
_Maxxx_ 5-Feb-14 17:23pm    
I can't even guess why that wouldn't work. I suggest

1. Post some relevant code here
2. Run in debug, and set up a breakpoint before you add the bracket - look at the Text property then step over the 'bracket adding code' and look again -

This isn't really an answer but I wanted to be able to format the code ...

Your code you posted - with my comments...

VB
Txtsolution.Text = Math.Sin(Txtsolution.Text)
' so Txtsoluton.Text now has the Sin of whatever was there originally
variable1 = Val(txtsolution.Text)
Txtsolution.Text = ""
' now txtSolution.Text is empty
operation = "+"
variable2 = Val(Txtsolution.Text)
' variable2 is now jsut 0 I guess, as Txtsolution.Text is an empty string
If operation = "+" Then
' operation IS = + because you just set it
    resultat = variable1 + variable2
' resultat will be the sum of the Sin (calculated earlier) and 0 (so just the Sin value!)
    Txtsolution.Text = resultat
   ' now Txtsolution.Text = the Sin value calculated
End If


This makes no sense to me - I thought you were asking about a bracket? I see no bracket in your code, and the code just doesn't make sense to me (not to mention that some of your code is a function and the rest is just, sort of, there.

Have you just copied and pasted random code or is this actually a part of your program?
 
Share this answer
 
no those are examples of the program but different part
i put the sin as an example of all the math equation and did i put their code
and
variable1 = Val(txtsolution.Text)
Txtsolution.Text = ""
operation = "+"
i put it it in the + button
and
variable2 = Val(Txtsolution.Text)
If operation = "+" Then
resultat = variable1 + variable2
Txtsolution.Text = resultat
End If
i put it in the = button sry i was not clear about how i put the code
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900