How to add numbers to a number

Code: Copy
Sub ImageView1_Click
   Select Msgbox2("Would You Like To By This?" , "Conferm Order" , "yes","Cancel" , "no" ,LoadBitmap(File.DirAssets,"bud_icon_007.jpg"))    
    
     Case DialogResponse.POSITIVE
      money1 = money1 - "20"
      label1.Text = ""
      label1.Text = "$" & money1
      imageview1.Bitmap = LoadBitmap(File.DirAssets,"bud1owned.jpg")
      ownedamountitem1 = ownedamountitem1 + "1"
      imageview3.Bitmap = LoadBitmap(File.DirAssets,"bud_icon_007.jpg")
      labelitemamount1.Text = ownedamountitem1
    Case DialogResponse.NEGATIVE
        
    Case Else
        ToastMessageShow("No",False)
End Select
End Sub
see my problem is here
Code: Copy
ownedamountitem1 = ownedamountitem1 + "1"
 
You don't need quotes around the numbers.

If money > 0 then
'Do something
End If

-------------------
Sent via Tapatalk
 
Upvote 0
Have you loaded a layout that contains a label?

Activity.Loadlayout("1.bal")

-------------------
Sent via Tapatalk
 
Upvote 0
can you fix the errors and post back the code?

We won't fix your code for you, but we'll show you how to fix it. The point is that you learn.

From what I can see, nowhere in your layout do you have a label named Label1 - you have one named Label2, however.

Rename Label2 to Label1 and your issue should be fixed.
 
Last edited:
Upvote 0
Nah I have a labelbox1 but not a 2

Oh, it's just hidden - you have Label1 and Label2.

Go to your Globals and note how you say:

Code: Copy
   Dim label1 As Label

Strings are case sensitive. Changing "label1" to "Label1" will fix your issue.
 
Upvote 0
The program won't run as it is, there are errors. If you run it in debug mode, it'll give you a line number and you can fix each one in turn. The first on is an error with the MsgBox syntax. You've had a few suggestions, implement these first then if you find a problem you can't identify post again, with the amended code so we don't all have to do it.
 
Upvote 0
Then error I get is at:

money.Visible = True

You have a Dim for a label called money, but it's not in the loaded layout 1.

There is one in the homescreen layout but you haven't loaded that.

How you sort this is a matter of design.
 
Upvote 0
Yes although they are two separate errors.

As I said the first one is because you do not have Label1 defined in the Layout you have loaded.

The second is because you are still adding "1" (in quotes) in line 128:

Code: Copy
labelitemamount1.Text + "1"

It should be:

Code: Copy
labelitemamount1.Text + 1
 
Upvote 0
Back
Top