Results 1 to 3 of 3

Thread: Begging Help - About Forms

  1. #1

    Thread Starter
    Addicted Member charmedcharmer's Avatar
    Join Date
    Sep 2003
    Posts
    211

    Begging Help - About Forms

    I designed a form so it could function like the MsgBox(). So there'll be at least 2 buttons, Ok and Cancel. Now in using the MsgBox() you an evaluate what the user pressed by simply

    Code:
         result = MsgBox "Blah, Blah, Blah"
    I also want my newly created form to execute a result when the buttons inside it are pressed. ANy suggestion on how I'll do this?
    C++ Programming is overwhelming.

    Dont let it overwhelm you or you'll fall into the oblivion of its perfection

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    check this thread, it might help you
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Add a method (function) to your message box form. Include any required arguments in the parameters list.

    VB Code:
    1. 'in message box form
    2. Private mlngResult as VbMsgBoxResult
    3.  
    4. Public Function GetResult(Byval MessageText as String) as VbMsgBoxResult
    5.  
    6.      txtMessage.Text = MessageText
    7.  
    8.      Me.Show vbModal
    9.  
    10.      GetResult = mlngResult
    11.  
    12.      Unload Me
    13.  
    14. End Function
    15.  
    16. Private Sub cmdOk_Click()
    17.       mlngResult = vbOk
    18.       Me.Hide
    19. End Sub
    20.  
    21. Private Sub cmdCancel_Click()
    22.      mlngResult = vbCancel
    23.      Me.Hide
    24. End Sub
    25.  
    26. 'in any other form
    27. If frmMessageBox.GetResult("This is a test") = vbOk Then
    28. Else
    29. End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width