Click here to Skip to main content
15,920,111 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Serial data receive routing Pin
SepPax11-May-15 10:07
SepPax11-May-15 10:07 
GeneralRe: Serial data receive routing Pin
Sascha Lefèvre11-May-15 10:24
professionalSascha Lefèvre11-May-15 10:24 
GeneralRe: Serial data receive routing Pin
SepPax11-May-15 20:42
SepPax11-May-15 20:42 
GeneralRe: Serial data receive routing Pin
Richard MacCutchan11-May-15 21:12
mveRichard MacCutchan11-May-15 21:12 
GeneralRe: Serial data receive routing Pin
SepPax12-May-15 1:56
SepPax12-May-15 1:56 
GeneralRe: Serial data receive routing Pin
Richard MacCutchan12-May-15 5:05
mveRichard MacCutchan12-May-15 5:05 
GeneralRe: Serial data receive routing Pin
SepPax13-May-15 0:49
SepPax13-May-15 0:49 
QuestionUse of an object without creating an instance...error Pin
SepPax11-May-15 0:02
SepPax11-May-15 0:02 
Hi guys,
getting crazy about this issue, can't figure out the reason. I'm sure that a more skilled eye than mine can get the point, any help is welcome.

I get the below error (see end of the code).
Basically I have a decoding function feeded with a key (pbKey), an input array (pbIn) and an output array (pBout).

Don't understand what VB is asking for...
Seppax

VB
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
     
     Dim k As Byte() = {&H1F, &H33, &H52, &H59, &H02, &H04, &H77, &H67, &H13, &H0E, &H00, &H15, &H15, &H02, &H0F}
     Dim dat As Byte() = {&H5F, &H4F, &HDA, &HA3, &H97, &H14, &H81, &HB1}
 
     Dim s, a As String
     Dim out As Byte()
  
      TeaD(k, dat, out)
 End Sub

 Private Function TeaD(ByVal pbKey() As [Byte], ByVal pbIn() As [Byte], ByVal pbOut() As [Byte]) As Byte()

     Dim i As [Byte] = New [Byte]()                   
     Dim y As UInteger                                
     Dim z As UInteger                                
     Dim sum As UInteger = &HC6EF3720UI               
     Dim delta As UInteger = &H553569AAUI             
     Dim n As UInteger = 32                           
     Dim k(4) As UInteger                             

         y = pbIn(2)                                      
        z = pbIn(6)                                      
        k(0) = pbKey(2)                                   
        k(1) = pbKey(6)                                  
        k(2) = pbKey(10)                                  
        k(3) = pbKey(14)                                 

        For i = 0 To 2                                   
            y <<= 8                                     
            z <<= 8                                     
            k(0) <<= 8                                  
            k(1) <<= 8                                  
            k(2) <<= 8                                    
            k(3) <<= 8                                   
            y = y Or pbIn(2 - i)                         
            z = z Or pbIn(6 - i)                        
            k(0) = k(0) Or pbKey(2 - i)                  
            k(1) = k(1) Or pbKey(6 - i)                  
            k(2) = k(2) Or pbKey(10 - i)                 
            k(3) = k(3) Or pbKey(14 - i)                 
        Next i

        Do While n > 0                                 
            z -= ((y << 4) Xor (y >> 5)) + y Xor (sum + k(sum >> 11 And 3))      
            sum -= delta                                                         
            y -= ((z << 4) Xor (z >> 5)) + z Xor (sum + k(sum And 3))            
            n = n - 1
        Loop


        For i = 0 To 3                                   
                pbOut(i) = y ' <--- ERROR 
    ' You may have tried to use an object without providing an instance of the object.

                pbOut(i + 4) = z  ' <--- ERROR 
    ' You may have tried to use an object without providing an instance of the object.            
                y >>= 8                                      
                z >>= 8                         ' 
         Next i
 End Function

AnswerRe: Use of an object without creating an instance...error Pin
Sascha Lefèvre11-May-15 0:15
professionalSascha Lefèvre11-May-15 0:15 
GeneralRe: Use of an object without creating an instance...error Pin
SepPax11-May-15 0:41
SepPax11-May-15 0:41 
GeneralRe: Use of an object without creating an instance...error Pin
Sascha Lefèvre11-May-15 1:10
professionalSascha Lefèvre11-May-15 1:10 
GeneralRe: Use of an object without creating an instance...error Pin
SepPax11-May-15 7:09
SepPax11-May-15 7:09 
GeneralRe: Use of an object without creating an instance...error Pin
Sascha Lefèvre11-May-15 7:17
professionalSascha Lefèvre11-May-15 7:17 
QuestionRetrieve document file stored in sql server database Pin
careLess aucim6-May-15 19:08
careLess aucim6-May-15 19:08 
AnswerRe: Retrieve document file stored in sql server database Pin
Mycroft Holmes6-May-15 19:25
professionalMycroft Holmes6-May-15 19:25 
QuestionSending e-mail using vb.net Pin
waner michaud5-May-15 6:10
waner michaud5-May-15 6:10 
AnswerRe: Sending e-mail using vb.net Pin
Ferd Really5-May-15 11:08
Ferd Really5-May-15 11:08 
AnswerRe: Sending e-mail using vb.net Pin
Richard MacCutchan5-May-15 21:21
mveRichard MacCutchan5-May-15 21:21 
GeneralRe: Sending e-mail using vb.net Pin
waner michaud6-May-15 2:55
waner michaud6-May-15 2:55 
GeneralRe: Sending e-mail using vb.net Pin
Richard MacCutchan6-May-15 3:02
mveRichard MacCutchan6-May-15 3:02 
GeneralRe: Sending e-mail using vb.net Pin
Eddy Vluggen6-May-15 3:23
professionalEddy Vluggen6-May-15 3:23 
GeneralRe: Sending e-mail using vb.net Pin
waner michaud6-May-15 4:48
waner michaud6-May-15 4:48 
GeneralRe: Sending e-mail using vb.net Pin
Dave Kreskowiak6-May-15 11:13
mveDave Kreskowiak6-May-15 11:13 
AnswerRe: Sending e-mail using vb.net Pin
ZurdoDev6-May-15 10:28
professionalZurdoDev6-May-15 10:28 
QuestionWanted: control for entering datetimeoffset values in Winforms (similar to datetimepicker) Pin
atrus27114-May-15 2:17
atrus27114-May-15 2:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.