Solved

Replace msgbox with a form

Posted on 2014-10-06
13
99 Views
Last Modified: 2014-10-09
I am trying to use a form to replace the message box vb provides to be more informative
the current messagebox cannot have a Rename button

the messagebox to replace

If mstrCboText <> cboBids.Text Then 'selected item is different name than typed text
             Select Case MsgBox("Do you want to rename mstrCboText to cboBids.Text click ""Yes""" _
                                & vbCrLf & "To add as as new Catagory click ""No""" _
                                & vbCrLf & "To cancel click""Cancel""" _
                                , vbYesNoCancel Or vbQuestion Or vbDefaultButton1, App.Title)
             
                Case vbYes
                    cboBids.List(mintLI) = cboBids.Text
                    cboBids.ListIndex = mintLI
                Case vbNo
                    cboBids.AddItem cboBids.Text
                Case vbCancel
                   cboBids.Text = mstrCboText ' put back the original text
             End Select

the code for calling the custom form
 Dim iResponse As VBA.VbMsgBoxResult, sPrompt As String
    Dim sCurrSection As String, sTypedText As String
    sCurrSection = mstrCboText
     sTypedText = Me.cboBids.Text
                 
    frmMessTemplate.gOldName = sCurrSection
   
         frmMessTemplate.gNewName = sTypedText
         frmMessTemplate.Show vbModal

I am having trouble handling the return values from the custom form
Eg:
cmdNew
'new combobox item
cmdRename
'rename the current selected item
cmdCancel
'cancel the procudure

I am thinking of making a public sub in the calling form to handle the return valueformmessageboxformmessagebox
0
Comment
Question by:isnoend2001
  • 7
  • 4
  • 2
13 Comments
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40364259
This project uses a form for the "msgbox" and you can alter it in any way you like.
message.zip
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40364270
Or seeing as though you seem to have most of it done, if you attach your project in a zip file I'll take a look at it.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40364276
I forget... are you using Excel or VB6? If it's the former just upload your workbook.
0
 
LVL 32

Expert Comment

by:ste5an
ID: 40364296
Mixing those two different actions (new, rename) in one dialog is not a good idea. Dialogs should guide the user. A dialog like yours does basically nothing on this behalf.

Just my 2¢.
0
 

Author Comment

by:isnoend2001
ID: 40364325
Thanks  MartinLiss  using vb6 too many ocx's to redo to upload

ste5an, seems pretty obvious to me Rename or New what alternatives are there?
0
 
LVL 32

Expert Comment

by:ste5an
ID: 40364342
An educated users already knows what he wants to do. So this dialog is a blocker in the normal work-flow. Provide a toolbar, a context menu where the user can directly choose the desired action.

The dialog does also not provides any help to the user. So there is no benefit in having it.

p.s. this is a general thought, maybe there are reasons in your case to use such a dialog. But you've given to few information.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 45

Expert Comment

by:Martin Liss
ID: 40364367
Try this little project. It uses a Private Property to return the index of the button clicked. The 4th butoon contains this line of code

MsgBox "You pressed the button with an Index value of " & ButtonPressed

which if used someplace will need to be changed to

MsgBox "You pressed the button with an Index value of " & Form1.ButtonPressed
Q-28532225.zip
0
 

Author Comment

by:isnoend2001
ID: 40364385
Thanks ste5an, the user may know what they want to do, but the software does not eg;
User makes a selection from the combo box and then types over the name.
Do they want to create a new item or rename the old item. the software does not know
0
 

Author Comment

by:isnoend2001
ID: 40364411
Thanks MartinLiss that is fine and dandy, but it does not return the value to the calling form
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40364556
Sure it will but first please define what you mean by the "calling form". Is it the form that has the buttons like your "Action Confirmation" form or is it another form that loads the "Action Confirmation" form?
0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40364571
Here's the same project with the addition of a second form.
Q-28532225.zip
0
 

Author Closing Comment

by:isnoend2001
ID: 40372106
thank you
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40372129
You're welcome.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now