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. Windows Forms
  4. Global Variable

Global Variable

Scheduled Pinned Locked Moved Windows Forms
database
8 Posts 4 Posters 4 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.
  • O Offline
    O Offline
    ozzyrocsdbn
    wrote on last edited by
    #1

    I have a login box with Validation against a Password database I would like to use the UserNo. in another form I have menthod Public sub frmLogin(Byval Userno as String) dim login as integer login = Cint(Log) { Now how do use that login variable in another form)

    G B V 3 Replies Last reply
    0
    • O ozzyrocsdbn

      I have a login box with Validation against a Password database I would like to use the UserNo. in another form I have menthod Public sub frmLogin(Byval Userno as String) dim login as integer login = Cint(Log) { Now how do use that login variable in another form)

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      Have a look at this article: passingvaluesbetweenforms[^]

      #region signature my articles #endregion

      O 1 Reply Last reply
      0
      • O ozzyrocsdbn

        I have a login box with Validation against a Password database I would like to use the UserNo. in another form I have menthod Public sub frmLogin(Byval Userno as String) dim login as integer login = Cint(Log) { Now how do use that login variable in another form)

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #3

        Create a property on this form that exposes the user no. The access that property from the other form before closing this one. You only hide the login form when done, and close or dispose it after reading the property.

        O 1 Reply Last reply
        0
        • B Brady Kelly

          Create a property on this form that exposes the user no. The access that property from the other form before closing this one. You only hide the login form when done, and close or dispose it after reading the property.

          O Offline
          O Offline
          ozzyrocsdbn
          wrote on last edited by
          #4

          That not so helpful But Thanks Any Code to support your Written disscussion

          B 1 Reply Last reply
          0
          • G Giorgi Dalakishvili

            Have a look at this article: passingvaluesbetweenforms[^]

            #region signature my articles #endregion

            O Offline
            O Offline
            ozzyrocsdbn
            wrote on last edited by
            #5

            Thanks So Much You Rock

            G 1 Reply Last reply
            0
            • O ozzyrocsdbn

              Thanks So Much You Rock

              G Offline
              G Offline
              Giorgi Dalakishvili
              wrote on last edited by
              #6

              You are welcome :)

              #region signature my articles #endregion

              1 Reply Last reply
              0
              • O ozzyrocsdbn

                That not so helpful But Thanks Any Code to support your Written disscussion

                B Offline
                B Offline
                Brady Kelly
                wrote on last edited by
                #7

                It's only not helpful if you choose to not explore what I said.

                1 Reply Last reply
                0
                • O ozzyrocsdbn

                  I have a login box with Validation against a Password database I would like to use the UserNo. in another form I have menthod Public sub frmLogin(Byval Userno as String) dim login as integer login = Cint(Log) { Now how do use that login variable in another form)

                  V Offline
                  V Offline
                  vims
                  wrote on last edited by
                  #8

                  If you want to use valid login name on another form after user authentication the you can create a public property on your another form and fill it with the value by accessing it before opening that form. Ex:--> if you are on "login.cs" and want to open "Admin.cs" then code for admin will have a public property say "UserNo" Private int userNo; Public property int UserNo { get { return userNo;} set { userNo = value;} } Now on login.cs after user validation Admin admin = new Admin() (( This depends opn your architecture)) admin.UserNo = login; admin.ShowDialog(); This way the user no will be available as per code optimization also. vims

                  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