Msgbox with confirmation and cancel

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hi,
is possibile to set a Msgbox, with buttons on it?
 

Ricky D

Well-Known Member
Licensed User
Longtime User
Have a look at Msgbox2

It accepts up to 3 buttons. Positive, Cancel and Negative

for example

B4X:
Dim i As Int
i = Msgbox2("Make a choice here", "This is the title", "Edit", "Cancel", "Delete", null)
Select i
  Case DialogResponse.POSITIVE Then 'Edit
  Case DialogResponse.CANCEL Then 'Cancel
  Case DialogResponse.NEGATIVE Then 'Delete
End Select

the null paramater is in place of a bitmap. I've never used this in my apps because I only write stuff for myself.

let's say you only want 2 buttons :

B4X:
Dim i As Int
i = Msgbox2("Make a choice here", "This is the title", "Yes", "", "No", null)

see the 2ndbutton has "" as it's text? This means don't show it

you then test it like this

B4X:
'Select statement or
If i=DialogResponse.POSITIVE Then   'do Yes code
Else If i=DialogResponse.NEGATIVE Then   'do No code
End If

Hope this helps.

regards, Ricky
 
Upvote 0
Top