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. dot syntax and concatenated names

dot syntax and concatenated names

Scheduled Pinned Locked Moved Visual Basic
csharpquestion
4 Posts 2 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.
  • B Offline
    B Offline
    brnwdrng
    wrote on last edited by
    #1

    Can object names be designated in (VB.NET) dot syntax on the fly? e.g., in c#: for (i=0;i<5;i++){ ["bullet" + i].Text = list.ChildNodes[i].InnerText; } ...would work, but this VB doesn't seem to: For i = 0 To 4 ("bullet" & i).Text = list.ChildNodes(i).InnerText Next i Is there a syntax in VB.NET that allow such a thing?

    F 1 Reply Last reply
    0
    • B brnwdrng

      Can object names be designated in (VB.NET) dot syntax on the fly? e.g., in c#: for (i=0;i<5;i++){ ["bullet" + i].Text = list.ChildNodes[i].InnerText; } ...would work, but this VB doesn't seem to: For i = 0 To 4 ("bullet" & i).Text = list.ChildNodes(i).InnerText Next i Is there a syntax in VB.NET that allow such a thing?

      F Offline
      F Offline
      FruitBatInShades
      wrote on last edited by
      #2

      ("bullet" & i). is interpreted as a string, try using the same syntax as in c# ["bullet" + i].Text = list.ChildNodes(i).InnerText

      B 1 Reply Last reply
      0
      • F FruitBatInShades

        ("bullet" & i). is interpreted as a string, try using the same syntax as in c# ["bullet" + i].Text = list.ChildNodes(i).InnerText

        B Offline
        B Offline
        brnwdrng
        wrote on last edited by
        #3

        Yeah, I tried that first, but VB didn't seem to like it either.

        F 1 Reply Last reply
        0
        • B brnwdrng

          Yeah, I tried that first, but VB didn't seem to like it either.

          F Offline
          F Offline
          FruitBatInShades
          wrote on last edited by
          #4

          For i = 0 To 4 ("bullet" & i).Text = list.ChildNodes(i).InnerText Next i I didn't think it would work, that would 'break' vb's typing. I think that was part of the argument when they re-wrote sections before release. VB programmers panicked when they say what the new language was like. Personally the nearer to c# (apart from readability) the better.

          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