There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen boot computer connection crash css dell drive driver drivers email error ethernet excel explorer firefox firefox 3 freeze game hard drive internet internet explorer itunes laptop malware monitor network networking nvidia outlook outlook 2003 outlook express partition password printer problem problems router slow sound startup trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Return value from a modal dialog?


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
tim8w's Avatar
Member with 35 posts.
 
Join Date: Nov 2004
Experience: New VB6 Programmer
08-Dec-2004, 04:16 PM #1
Cool Return value from a modal dialog?
I have the following code:

Dim dlgColorPicker As New frmColorPicker

dlgColorPicker.Show vbModal

Is there a way to get a value returned from the dialog? I want to know if the user pressed OK or Cancel. I know I can setup a global variable in frmColorPicker. Is this the only way?

Thanks,
Tim
Mosaic1's Avatar
Distinguished Member with 7,502 posts.
 
Join Date: Aug 2001
10-Dec-2004, 11:56 AM #2
How did you create this? Are you using a control you Downloaded? Or did you create a dialog and add code to it. If it is just a dialog you added to your project and are showing as modal, you can add code to the Cancel and Ok Button Click events. Please clarify a bit.
tim8w's Avatar
Member with 35 posts.
 
Join Date: Nov 2004
Experience: New VB6 Programmer
10-Dec-2004, 04:09 PM #3
Thumbs up Solution
I found some slick code to accomplish this:


Calling module:
Code:
Dim dlgColorPicker As New frmColorPicker
Dim iRet as VbMsgBoxResult

    iRet = dlgColorPicker.ShowForm
In frmColorPicker:
Code:
Private m_ReturnVal as VbMsgBoxResult

Public Function ShowForm() As VbMsgBoxResult

    Me.Show vbModal
    ShowForm = m_ReturnVal

End Function

Private Sub cmdOK_Click()
    m_ReturnVal = vbOK
End Sub

Private Sub cmdCancel_Click()
    m_ReturnVal = vbCancel 
End Sub
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:11 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.