isnoend2001
asked on
Replace msgbox with a form
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 value
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 value
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.
I forget... are you using Excel or VB6? If it's the former just upload your workbook.
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¢.
Just my 2¢.
ASKER
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?
ste5an, seems pretty obvious to me Rename or New what alternatives are there?
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.
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.
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
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
ASKER
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
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
ASKER
Thanks MartinLiss that is fine and dandy, but it does not return the value to the calling form
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
You're welcome.
message.zip