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,945 questions

51,887 answers

573 users

How to use simple struct in VB.NET

1 Answer

0 votes
Imports System

Structure myStruct
    Private n As Integer

    Public Property number As Integer
        Get
            Return n
        End Get
        Set(ByVal value As Integer)
            n = value
        End Set
    End Property

    Public Sub Print()
        Console.WriteLine("n = {0}", n)
    End Sub
End Structure

Class Program
	Public Shared Sub Main(ByVal args As String())
        Dim mystruct As myStruct = New myStruct()

        mystruct.number = 300
        Console.WriteLine(mystruct.number)

        mystruct.Print()
    End Sub
End Class
 
 
 
' run:
'
' 300
' n = 300
'

 



answered Mar 23, 2025 by avibootz

Related questions

1 answer 125 views
125 views asked Nov 15, 2022 by avibootz
1 answer 205 views
1 answer 109 views
1 answer 188 views
188 views asked Oct 22, 2018 by avibootz
3 answers 217 views
1 answer 117 views
117 views asked Apr 27, 2017 by avibootz
1 answer 168 views
168 views asked Oct 7, 2014 by avibootz
...