Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

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



Building the Right Environment to Support AI, Machine Learning and Deep Learning

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.



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