Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. creating a Form Having Return Value

creating a Form Having Return Value

Scheduled Pinned Locked Moved Visual Basic
question
10 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xstoneheartx
    wrote on last edited by
    #1

    I want to create a form such as a dialog box or a user control having return value how can i do it (for creating a dialogbox such as inputbox i defined a public variable and in fact i did not have return value but i save return value that user enterde in the my inputbox in this public var) thanx for your helps

    D J H 3 Replies Last reply
    0
    • X xstoneheartx

      I want to create a form such as a dialog box or a user control having return value how can i do it (for creating a dialogbox such as inputbox i defined a public variable and in fact i did not have return value but i save return value that user enterde in the my inputbox in this public var) thanx for your helps

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Best way to do it is to set a public property or variable. There are no return values such that your see in a Function statement. RageInTheMachine9532

      1 Reply Last reply
      0
      • X xstoneheartx

        I want to create a form such as a dialog box or a user control having return value how can i do it (for creating a dialogbox such as inputbox i defined a public variable and in fact i did not have return value but i save return value that user enterde in the my inputbox in this public var) thanx for your helps

        J Offline
        J Offline
        John Kuhn
        wrote on last edited by
        #3

        Calling a Form using the ShowDialog method, you can return a DialogResult value. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.

        1 Reply Last reply
        0
        • X xstoneheartx

          I want to create a form such as a dialog box or a user control having return value how can i do it (for creating a dialogbox such as inputbox i defined a public variable and in fact i did not have return value but i save return value that user enterde in the my inputbox in this public var) thanx for your helps

          H Offline
          H Offline
          Hesham Amin
          wrote on last edited by
          #4

          you can make a function is a module that shows a form as modal and returns the value from it.

          P X 3 Replies Last reply
          0
          • H Hesham Amin

            you can make a function is a module that shows a form as modal and returns the value from it.

            P Offline
            P Offline
            Pradeep C
            wrote on last edited by
            #5

            You can use a Shared Variable in the form class that will hold the value to be returned. "I think there is a world market for maybe 5 computers" Thomas Watson, chairman of IBM, 1943 "There is no reason anyone would want a computer in their home" Ken Olson, chairman & founder of Digital equipment, 1977 "This 'telephone' has too many shortcomings to be seriously considered as a means of communication. The device is ingerently of no value to us." Western Union internal memo, 1876 "640 K ought to be enough for anybody." Bill Gates, 1981 "Computers in the future may

            1 Reply Last reply
            0
            • H Hesham Amin

              you can make a function is a module that shows a form as modal and returns the value from it.

              X Offline
              X Offline
              xstoneheartx
              wrote on last edited by
              #6

              Hi Tanx but I couldn't undrestand what u mean please descibe your solution.:)

              H 1 Reply Last reply
              0
              • X xstoneheartx

                Hi Tanx but I couldn't undrestand what u mean please descibe your solution.:)

                H Offline
                H Offline
                Hesham Amin
                wrote on last edited by
                #7

                create a form (frmMessageBox) and a module (mdlMsgBox) in the mdlMsgBox create a Function :

                public function MyMsgBox() as integer
                frmMessageBox.Show vbModal
                MyMsgBox = frmMessageBox.ReturnValue
                end function
                

                where ReturnValue is a public Get property (read only) of the form.

                1 Reply Last reply
                0
                • H Hesham Amin

                  you can make a function is a module that shows a form as modal and returns the value from it.

                  X Offline
                  X Offline
                  xstoneheartx
                  wrote on last edited by
                  #8

                  Hi Tanx but I couldn't undrestand what u mean please descibe your solution.

                  R 1 Reply Last reply
                  0
                  • X xstoneheartx

                    Hi Tanx but I couldn't undrestand what u mean please descibe your solution.

                    R Offline
                    R Offline
                    Randy S
                    wrote on last edited by
                    #9

                    Try this 1st dim your second form from your main form. 2nd In the second form user will enter data into any object (text rdo...) 3rd exiting the form will be "me.hide". 4th control is then back to the main form at which point you can read the values that are in the objects of the second form. ex; Dim findEntry As New frmSearch findEntry.ShowDialog() 'Form is shown. Used to set variables for search If findEntry.DialogResult <> DialogResult.Abort Then ' Do search when true, = Abort when cancel btn clicked sSearchText = findEntry.txtSearchText.Text sSearchItem = CStr(findEntry.cboItems.SelectedItem) findEntry.Close() sSearch is a variable which is assigned the value from the second form. Last step is to close the second form.

                    J 1 Reply Last reply
                    0
                    • R Randy S

                      Try this 1st dim your second form from your main form. 2nd In the second form user will enter data into any object (text rdo...) 3rd exiting the form will be "me.hide". 4th control is then back to the main form at which point you can read the values that are in the objects of the second form. ex; Dim findEntry As New frmSearch findEntry.ShowDialog() 'Form is shown. Used to set variables for search If findEntry.DialogResult <> DialogResult.Abort Then ' Do search when true, = Abort when cancel btn clicked sSearchText = findEntry.txtSearchText.Text sSearchItem = CStr(findEntry.cboItems.SelectedItem) findEntry.Close() sSearch is a variable which is assigned the value from the second form. Last step is to close the second form.

                      J Offline
                      J Offline
                      jcs2004
                      wrote on last edited by
                      #10

                      Do you mean values to be return from a form where you put values, then when you close will return a value to be available at the next form? Please elaborate what particular return values you want, I may help you about this matter..

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups