Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,943 questions

51,884 answers

573 users

How to use external struct in class with VB.NET

1 Answer

0 votes
Imports System

Public Structure user
    Public FirstName As String
    Public LastName As String
    Public City As String
    Public Paid As Boolean
End Structure

Public Class Program
    Private Shared Function SetUserData() As user
        Dim u As user
        
        u.FirstName = "Darth"
        u.LastName = "Vader"
        u.City = "NY"
        u.Paid = True
        
        Return u
    End Function

    Private Shared Sub PrintUserData(ByVal u As user)
        Console.WriteLine(u.FirstName)
        Console.WriteLine(u.LastName)
        Console.WriteLine(u.City)
        Console.WriteLine(u.Paid)
    End Sub

    Public Shared Sub Main(ByVal args As String())
        Dim u As user = SetUserData()
        
        PrintUserData(u)
    End Sub
End Class

 
   
   
' run:
'
' Darth
' Vader
' NY
' True
'

 



answered Jun 21, 2024 by avibootz

Related questions

1 answer 91 views
1 answer 98 views
1 answer 188 views
188 views asked Oct 22, 2018 by avibootz
1 answer 136 views
1 answer 156 views
1 answer 212 views
...