MsgBox question

Coding + IDE + Code-Editor + Syntax + User-Functions + Anything else

MsgBox question

Postby GaryVass » Thu Sep 01, 2011 4:16 pm

I have a MsgBox requestor (below) that I can't get to work... it does work in kbasic....

response = MsgBox("No security found in Master Security List with a ticker of " & TTICK & " Would you like to add it now?", kbYesNo, "Should We Add This Asset to the List?")

With the above line I get a 'parser or syntax error' If I change the kbYesNo to vbYesNo I get a 'types incompatible error' response is dimmed as Integer. I have also tried Boolean to see if there were any differences (none).

What do I need to change?

Thanks in advance.
GaryVass
 
Posts: 109
Joined: Wed May 04, 2011 8:03 pm

Re: MsgBox question

Postby Slowdown » Thu Sep 01, 2011 5:29 pm

pulled from the examples and changed a bit,

Code: Select all
Sub ShowMsgBox()
  Dim ReturnValue As Integer

  ReturnValue = MessageBox(MessageBox.Warning, "This is a Warning", "My warning text", "informative text", "details and more...", MessageBox.Apply, List("VB_Yes", MessageBox.AcceptRole), List("VB_No", MessageBox.RejectRole))

  Print "When Accepted : " & MessageBox.AcceptRole & "\n"
  Print "When Applied  : " & MessageBox.Apply & "\n"
  Print "When rejected : " & MessageBox.RejectRole & "\n"
  Print "Returned by MessageBox : " & ReturnValue
End Sub
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: MsgBox question

Postby GaryVass » Thu Sep 01, 2011 5:57 pm

Thanks... I did not see those in the examples.... I guess you have to spell out messagebox as opposed to just the MsgBox that works for just simple messages.
GaryVass
 
Posts: 109
Joined: Wed May 04, 2011 8:03 pm

Re: MsgBox question

Postby berndnoetscher » Fri Sep 02, 2011 7:06 am

It works, but change:

kbYesNo must be vbYesNo
berndnoetscher
Site Admin
 
Posts: 344
Joined: Thu Mar 25, 2010 9:57 am

Re: MsgBox question

Postby Slowdown » Fri Sep 02, 2011 10:41 am

Sorry to report but,
Code: Select all
Dim ReturnValue As Integer

ReturnValue = MsgBox("some text", vbYesNo, "some more text")

Raises an error types incompatible.
edit;

It will work but not as showed.
This will work,
Code: Select all
Dim ReturnValue As List
ReturnValue.Append(MsgBox("some text", vbYesNo, "some more text"))
MsgBox(ReturnValue.Object(0))

Seems the function returns not an Integer but an Array :roll:
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: MsgBox question

Postby Henning » Fri Sep 02, 2011 1:07 pm

Hi,

What comes to mind is that MsgBox should, in this case, return the Value of the Constant for either vbYes or vbNo.
So one couls code:

If MsgBox("tatata", vbYesNo, "dididi") = vbYes Then
....
Else
....
End If

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: MsgBox question

Postby Slowdown » Fri Sep 02, 2011 3:51 pm

sorry Henning, no go same error.
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Re: MsgBox question

Postby Henning » Fri Sep 02, 2011 4:39 pm

Hi,

Not a valid program code, just a hint on how it, in my mind, is supposed to work. ;)

/Henning
Henning
 
Posts: 523
Joined: Fri Aug 13, 2010 6:29 pm

Re: MsgBox question

Postby GaryVass » Sat Sep 03, 2011 2:51 pm

Thanks Slowdown,

I used your answer to get a working set of code, as a list, of course, but it works or at least compiles so far.
GaryVass
 
Posts: 109
Joined: Wed May 04, 2011 8:03 pm

Re: MsgBox question

Postby Slowdown » Sun Sep 04, 2011 6:50 am

Be carefull,
If it's a bug and when repaired you will end up again with a none working code.
I don't know if my code is correct, it works but that is all. ;)
Kind regards,
Slowdown

OSX 10.8.x, VBox Xp, Ubuntu 32/64 bit, EOS 64 bit
Slowdown
 
Posts: 465
Joined: Sat May 01, 2010 7:11 pm
Location: Netherlands

Next

Return to Questions & Answers

Who is online

Users browsing this forum: No registered users and 0 guests

cron