Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8495163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:29:44+00:00 2026-06-10T23:29:44+00:00

I have a function to show a MsgBox with a text selected from an

  • 0

I have a function to show a MsgBox with a text selected from an array.

'# show the choosen message
Public Function ShowMessage(which)  
    ShowMessage = MsgBox(Message(which),vbyesno,"title")
end Function

The returnvalue from this function is the return value from the MsgBox itself. When I then try to ask for that value with an if-statement i get an error message saying that this is a wrong value assingment for that function.

if ShowMessage = vbYes then
    MsgBox "clicked ok"
    StartProgram("notepad.exe")
else
    MsgBox ("some error occurred")
end if

When i assing the value of ShowMessage to var1 and go for it with the if-statement I get no error messages.

'# show the choosen message
Public Function ShowMessage(which)  
    ShowMessage = MsgBox(Message(which),vbyesno,"title")
    var1 = ShowMessage
end Function

....

if var1 = vbYes then
    MsgBox "clicked ok"
    StartProgram("notepad.exe")
else
    MsgBox ("some error occurred")
end if

Why can’t I get access the value direct in that statement, or am I doing something wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:29:46+00:00Added an answer on June 10, 2026 at 11:29 pm

    That function needs a parameter, try this:

    Public Function ShowMessage(which)  
        ShowMessage = MsgBox(which,vbyesno,"title")
    end Function
    
    if ShowMessage("Heya, I'm a message") = vbYes then
        MsgBox "clicked ok"
        StartProgram("notepad.exe")
    else
        MsgBox ("some error occurred")
    end if
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a method public function show (text:Object=, title:String=, body=String=){ //blah } I want
I have a function called show which shows a dialog with the message. I
I have a following code which works fine MsgBox(AddSomething(Of String)(Hello, World)) Public Function AddSomething(Of
I have a function to show Dialog. public Dialog sendSMS(){ Dialog dialog = new
Imagine I have a class Window with a member function show which causes the
i have an application class inherited from QtGui.QDialog. I have to reload show-function but
I have a div show hide function which is working fine. when I click
I have added the following fine function to my status bar to show which
I have a Javascript function show() { alert(hello); } which runs on ASP Button
I have javascript function that show alert message and after 2 sec hide it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.