look this ...why is not the same?

Dim azar As New Random
        setd1(azar.Next(1, 7))
        setd2=(azar.Next(1, 7))

the second one setd2 give me a error... is not the same using =??
Which is the difference???
and...

Dim dados As New dado
dim dados2 as dado

Is this the same...o are Different? and again
Which is the difference??

Hi

What is "setd1" and "setd2"?
i am not sure what is happening, but it looks to me that they are procedures that dont return anything, maybe?

about the second one,

Dim dados As New dado
dim dados2 as dado

the first one you are creating a new object/variable (hence the word new) of type dado; the second one you are declaring a variable that probably has not been initialized yet.

hope it helps.

- Tutankamon

yeah both are sub....


besides I have one more question........

I am new..in this modules.class...type..is really hard to me when I need to know when use a sub or when I need use a function..like this

I need to know..juan,maria,and pedro age...and I want to know if are equal ...

this easy but I am confuse...if I need use a if...in a sub or in a function..

I have this

Public Class calcular
    Private juan, maria, pedro As Byte

    Public Sub setjuan(ByVal value As Integer)
        juan = value
    End Sub
    Public Sub setmaria(ByVal value As Integer)
        maria = value

    End Sub
    Public Sub setpedro(ByVal value As Integer)
        pedro = value

    End Sub

    Public Function getjuan()
        Return juan
    End Function

    Public Function getmaria()
        Return maria
    End Function

    Public Function getpedro()
        Return pedro

    End Function


End Class

ah, although this would work, you are doing it the wrong way.

Usually to set and get the proprties of a class you use the set and get

Public Property X() As Integer
Get
 Return x
End Get
Set(ByVal Value As Integer)
 x = value
End Set
End Property

what you might want to do is to create a class "person" and with some properties like age, weight, height, etc. Then create an object for each person.

something like this:

public class person
 private age, weight, height as integer
 ' set your properties here.
end class

sub main()
 dim juan, maria pedor as person
 juan.age = 21
 maria.age = 30
 pedro.age = 40


dim ageDiff as integer = maria.age - pedro.age
end sub

something like this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.