Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Dec 4, 2000

Union Structure in Visual Basic


When using C++, the Union enables programmers to look at the same memory area from different perspectives. The same is possible in Visual BASIC. There is an LSET statement that allows two variables to be overlapped in the same memory area.
  
Private Type MyType1
    x as Integer
    y as Integer
    z as Integer
    w as Integer
End Type
 
Private Type MyType2
    a as Long
    b as Long
End Type
 
Private Sub Form_Load()
    Dim t1 as MyType1
    Dim t2 as MyType2
    t1.x = 0
    t1.y = 0
    t1.z = -1
    t1.w = -1
 
    LSet t2 = t1
    Call MsgBox (t2.a & 
Yiming Sun
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date