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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. How do I initialize instantiiation of a multifield record

How do I initialize instantiiation of a multifield record

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasesql-servervisual-studio
3 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.
  • R Offline
    R Offline
    reykentj
    wrote on last edited by
    #1

    ENvironment. VB.net, SQl Server 2005, Visual Studio 2005, VB.net Stored procedures. I have defined a public class foo public index as long public fname as string public lname as string end class A sub wants to use this class as folows: Public Shared sub doit(byval fname as string, byval lname as string) dim myrecord as foo myrecord.fname = fname visual studio and vb tell me that my record is not initialized and may throw an exception if it is used without being initialized. It does throw an exception. How do I initialize myrecord. I have tried public class foo public index as long = 0 public fname as string = "xxx" public lname as string = "xxx" end class The compiler did not complain, but it did not solve the problem. rkj

    A 1 Reply Last reply
    0
    • R reykentj

      ENvironment. VB.net, SQl Server 2005, Visual Studio 2005, VB.net Stored procedures. I have defined a public class foo public index as long public fname as string public lname as string end class A sub wants to use this class as folows: Public Shared sub doit(byval fname as string, byval lname as string) dim myrecord as foo myrecord.fname = fname visual studio and vb tell me that my record is not initialized and may throw an exception if it is used without being initialized. It does throw an exception. How do I initialize myrecord. I have tried public class foo public index as long = 0 public fname as string = "xxx" public lname as string = "xxx" end class The compiler did not complain, but it did not solve the problem. rkj

      A Offline
      A Offline
      amaneet
      wrote on last edited by
      #2

      try this one dim myrecord as new foo this may help u.

      R 1 Reply Last reply
      0
      • A amaneet

        try this one dim myrecord as new foo this may help u.

        R Offline
        R Offline
        reykentj
        wrote on last edited by
        #3

        That did work. Thank you very much!!:) rkj

        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