[VB.NET] Byte problem :[

Custom Title Activated
Loyal Member
Joined
May 18, 2006
Messages
2,064
Reaction score
14
What is a byte exactly? When I make a function that requires a byte.

I put in any number between 0 - 255, but it errors that it cannot be converted to 1 dimensional array. <_<
 
What is a byte exactly? When I make a function that requires a byte.

I put in any number between 0 - 255, but it errors that it cannot be converted to 1 dimensional array. <_<

Visual Basic.NET is supposed to be simple, but your question doesn't make much sense. I wrote a tiny program that demonstrates how to set a byte, how to read it and how to change it.

Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'start my sub
        mySub()

    End Sub

    Private Sub mySub()
        'declare variable as byte and set value 20
        Dim myByte As Byte = 20

        'display result from my function in a messagebox
        MsgBox(myFunction(myByte).ToString)

        'change byte variable to value 80
        myByte = 80

        'again display result from my function in a messagebox
        MsgBox(myFunction(myByte).ToString)
    End Sub

    Private Function myFunction(ByVal anyByte As Byte) As Boolean
        If anyByte > 60 Then
            Return True
        Else
            Return False
        End If
    End Function

End Class
 
Back