Skip to first unread message

Mehmet Uzun

unread,
Sep 18, 2017, 4:11:52 PM9/18/17
to MIT App Inventor Forum
Hi there,

I try to make a kind of calculator with App inventor 2. Since I finished with design and blocks, I installed the program, I got the error written in the title: Screen.yail:280:1089 and previously 280:1093. Could you guys help me about this problem? This happens when I click on the "PlusBut" whose click button could be seen at the attachment.

Moreover, previously I had the code of the same program in VB2010, which I tried to adapt it to the Appinventor blocks, may help you understand the blocks more easily. Here is the C code of the block I get help:

 Private Sub PlusBUT_Click(ByVal sender As Object, ByVal e As EventArgs) Handles PlusBUT.Click

        If Not ANTextBox.Text = "" Then
            If ResultTextBox.Text = "" Then
                ANTextBox.Text = ANTextBox.Text + "+ "
                If Not X1 = 0 And Not X2 = 0 Then
                    ResultTextBox.Text = X1 + X2
                End If
            Else
                ANTextBox.Text = ANTextBox.Text + "+ "
                ResultTextBox.Text = ResultTextBox.Text + X2
                TextBox1.Text = (ResultTextBox.Text / 604) * 100
                TextBox2.Text = 604 - ResultTextBox.Text
                TextBox6.Text = (TextBox2.Text / 365) * 2
                TextBox3.Text = TextBox6.Text / 2
                TextBox5.Text = TextBox3.Text / 2
                TextBox4.Text = (TextBox5.Text / 3) * 2
            End If
        End If

Thanks in advance,

Best regards
screenshot-PlusBut.png

Evan Patton

unread,
Sep 18, 2017, 6:01:35 PM9/18/17
to MIT App Inventor Forum
Hi Mehmet,

There are a few problems here:
1) There are two empty number blocks in your first two if checks that should be empty Text blocks instead.
2) You are using the Math blocks to concatenate strings when you really need to use the join block in the Text drawer. You should also replace the + in a Number block with a + in a Text block.

Evan

Mehmet Uzun

unread,
Sep 19, 2017, 4:19:47 AM9/19/17
to MIT App Inventor Forum
Dear Evan,

Thank you very much for the information. So far, I'm trying to find out which blocks to change into "join" text block as you mentioned. I made some changes like giving initial conditions for AntTextBox and ResultTextBox.

By the way, AntTextBox is only to show the calculation like "1+2+3" where I could use "join block" for it easily i guess. But for the ResultTextBox, i kindly wish to know how could i mention rather then math blocks, the addition, substraction, multiplication and division operations. I'm not sure about if what i have done is true. (Please see attachment)

Another issue I got so far is when i click the button whose blocks could be seen at left at attachment, i get the error "Bad arguments to + The operation + cannot accept the arguments:, [*empty string*],[1]

Mehmet
screenshot-PlusBut2.png

Mehmet Uzun

unread,
Sep 19, 2017, 8:07:04 AM9/19/17
to MIT App Inventor Forum
I guess, I solved the problem dear Mr. Patton. Thank you for your interest in the problem. If you are interested in, you may find in the attachment the latest version of blocks. 

Thanks in advance,

Best regards,

Mehmet
screenshot-PlusBut3.png
Reply all
Reply to author
Forward
0 new messages