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. What is := in VB.net

What is := in VB.net

Scheduled Pinned Locked Moved Visual Basic
questioncsharptutorial
11 Posts 7 Posters 1 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
    xx77abs
    wrote on last edited by
    #1

    Well, subject tells everything ... I can't find what := does in VB.NET ... Here's one example ... SwitchDesktop(hDesktop:=p_lngHwnd) Can anyone tell me ? thanks :)

    L T N J P 6 Replies Last reply
    0
    • X xx77abs

      Well, subject tells everything ... I can't find what := does in VB.NET ... Here's one example ... SwitchDesktop(hDesktop:=p_lngHwnd) Can anyone tell me ? thanks :)

      L Offline
      L Offline
      lisan_al_ghaib
      wrote on last edited by
      #2

      [Message Deleted]

      X 1 Reply Last reply
      0
      • X xx77abs

        Well, subject tells everything ... I can't find what := does in VB.NET ... Here's one example ... SwitchDesktop(hDesktop:=p_lngHwnd) Can anyone tell me ? thanks :)

        T Offline
        T Offline
        Thomas Stockwell
        wrote on last edited by
        #3

        This might be able to help you[^]. It is also possible that, that is VB6 syntax.

        Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my Blog

        X 1 Reply Last reply
        0
        • L lisan_al_ghaib

          [Message Deleted]

          X Offline
          X Offline
          xx77abs
          wrote on last edited by
          #4

          Are you telling me that ":=" is the same as "=" ? But then why does it exist ?

          1 Reply Last reply
          0
          • T Thomas Stockwell

            This might be able to help you[^]. It is also possible that, that is VB6 syntax.

            Regards, Thomas Stockwell Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Visit my Blog

            X Offline
            X Offline
            xx77abs
            wrote on last edited by
            #5

            Sorry, couldn't find ":=" at that link. But thanks :) And I don't know if it existed in VB6 ...

            1 Reply Last reply
            0
            • X xx77abs

              Well, subject tells everything ... I can't find what := does in VB.NET ... Here's one example ... SwitchDesktop(hDesktop:=p_lngHwnd) Can anyone tell me ? thanks :)

              N Offline
              N Offline
              Nick Rioux
              wrote on last edited by
              #6

              It's for named parameters. For example:

              Sub ShowMsg(ByVal a as String, ByVal b as String, ByVal c as String)
              MsgBox(a & b & c)
              End Sub

              Sub Main()
              'Notice how a, b, and c are out of order.
              ShowMsg(c := "!", b := " World", a := "Hello")
              End Sub

              X 1 Reply Last reply
              0
              • X xx77abs

                Well, subject tells everything ... I can't find what := does in VB.NET ... Here's one example ... SwitchDesktop(hDesktop:=p_lngHwnd) Can anyone tell me ? thanks :)

                J Offline
                J Offline
                Jon_Boy
                wrote on last edited by
                #7

                Unless I am mistaken, := allows you to pass variables by name vs. by position (example below is freehand). Example sub: sub test (byval Value1 as string, byval Value2 as integer, byval Value3 as object) Normal way to call by position: Call sub test("value1", 2, new object) call by name: Call sub test(Value3:= New object, Value2:=2, Value3:="doh!") Generally you see the := used in attributes.

                Any suggestions, ideas, or 'constructive criticism' are always welcome.

                X 1 Reply Last reply
                0
                • N Nick Rioux

                  It's for named parameters. For example:

                  Sub ShowMsg(ByVal a as String, ByVal b as String, ByVal c as String)
                  MsgBox(a & b & c)
                  End Sub

                  Sub Main()
                  'Notice how a, b, and c are out of order.
                  ShowMsg(c := "!", b := " World", a := "Hello")
                  End Sub

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

                  Thank you very much, now I understand ! ;)

                  1 Reply Last reply
                  0
                  • J Jon_Boy

                    Unless I am mistaken, := allows you to pass variables by name vs. by position (example below is freehand). Example sub: sub test (byval Value1 as string, byval Value2 as integer, byval Value3 as object) Normal way to call by position: Call sub test("value1", 2, new object) call by name: Call sub test(Value3:= New object, Value2:=2, Value3:="doh!") Generally you see the := used in attributes.

                    Any suggestions, ideas, or 'constructive criticism' are always welcome.

                    X Offline
                    X Offline
                    xx77abs
                    wrote on last edited by
                    #9

                    Thanks, now I understand ! :)

                    1 Reply Last reply
                    0
                    • X xx77abs

                      Well, subject tells everything ... I can't find what := does in VB.NET ... Here's one example ... SwitchDesktop(hDesktop:=p_lngHwnd) Can anyone tell me ? thanks :)

                      P Offline
                      P Offline
                      Polymorpher
                      wrote on last edited by
                      #10

                      you can use it to assign values like you did in that function call...say some of those are optional and you want to assign directly to the variable name..

                      -- "Keyboard not found. Press < F1 > to RESUME. " Source unknown (appears in many common BIOSes as a real error message)

                      1 Reply Last reply
                      0
                      • X xx77abs

                        Well, subject tells everything ... I can't find what := does in VB.NET ... Here's one example ... SwitchDesktop(hDesktop:=p_lngHwnd) Can anyone tell me ? thanks :)

                        B Offline
                        B Offline
                        Bongumusa
                        wrote on last edited by
                        #11

                        in my 16 years experience in VB, ive never use this sign :=

                        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