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. <_<
Printable View
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. <_<
http://en.wikipedia.org/wiki/Byte
(Yet another proof that VB is not a real programming language and all those that use it are hopeless n00bs...)
I know it isn't a real programming language, but it gets the task done. ;]
your method is probably after a byte array.
in c# its:
byte[] byteArray = new byte [] { 0xFF };
QFT. :wink:
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