Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Hi, i am new to VB.NET and i am doing my final year project on VB.NET. I have completed half of my application but i have no idea that how to interface at89s52 with my application via wifi. I have an application that was written in VB6 this application will interface the kit through the wifi and take the value from at89s52 micro controller. I have the code to interface it but it was written on vb6 and i don't know how to write an equivalent code in VB.NET.

VB
Dim j, FL As Integer
Dim I As Long

Dim a As String
Dim x, y, x1 As Integer
Dim a1, b1, c1, a2, b2, c2, d1, d2, cc, ff As Integer

Private Sub Command1_Click()
MSComm1.Output = "C"
End Sub

Private Sub Command10_Click()
Winsock1.SendData "BB"
End Sub

Private Sub Command11_Click()
Winsock1.SendData "DD"
End Sub

Private Sub Command2_Click()
MSComm1.Output = "D"
End Sub

Private Sub Command3_Click()
MSComm1.Output = "A"
FL = 1
End Sub

Private Sub Command4_Click()
MSComm1.Output = "E"
FL = 2
End Sub

Private Sub Command5_Click()
MSComm1.Output = "F"
End Sub

Private Sub Command6_Click()
MSComm1.Output = "E"
End Sub

Private Sub Command7_Click()
Winsock1.Connect
End Sub

Private Sub Command8_Click()
Winsock1.SendData "AA"
End Sub

Private Sub Command9_Click()
Winsock1.SendData "CC"
End Sub

Private Sub Form_Load()
'MSComm1.PortOpen = True
Picture1.Scale (0, 260)-(1000, 0)
Picture2.Scale (0, 260)-(1000, 0)
End Sub

Private Sub Timer1_Timer()
On Error Resume Next
a = MSComm1.Input
If a <> "" Then
Text1 = a
Text9 = a
End If

For I = 1 To 20
    If Mid$(Text1.Text, I, 1) = "A" Then
   ' If Mid$(Text1, I + 4, 1) = "V" Then
        Text5.Text = Val(Mid$(Text1.Text, I + 1, 3))
   ' End If
    End If
    If Mid$(Text1.Text, I, 1) = "B" Then
    'If Mid$(Text1, I + 4, 1) = "T" Then
        Text4.Text = Val(Mid$(Text1.Text, I + 1, 3))
    'End If
    End If
    If Mid$(Text1.Text, I, 1) = "C" Then
    '    If Mid$(Text1, I + 4, 1) = "G" Then
        Text2.Text = Val(Mid$(Text1.Text, I + 1, 3))
    'End If
    End If
    If Mid$(Text1.Text, I, 1) = "D" Then
    '    If Mid$(Text1, I + 4, 1) = "G" Then
        Text6.Text = Val(Mid$(Text1.Text, I + 1, 3))
    'End If
    End If
    
    Text3 = 100 / (Val(Text5) + 1) / (Val(Text4) + 1) / (Val(Text2) + 1)
Next I
End Sub

Private Sub Timer3_Timer()
    a1 = Val(Text5.Text)
    Picture1.Line (x1, a1)-(x1 + 1, a2)
    a2 = a1
    b1 = Val(Text4.Text)
    Picture2.Line (x1, b1)-(x1 + 1, b2)
    b2 = b1
      c2 = c1
    d2 = d1
    x1 = x1 + 1
    If x1 > 1000 Then
    Picture1.Cls
    Picture2.Cls
   x1 = 0
    End If
End Sub

Private Sub Timer4_Timer()
WebBrowser1.Navigate ("http://hadronsoft.com/project16/data1log.php?A=" + Text5 + "&B=" + Text4 + "&C=" + Text2 + "&D=" + Text6)
End Sub

Private Sub Timer7_Timer()
On Error Resume Next
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
   Dim strData As String
    
 Winsock1.GetData strData, vbString
   
   a = strData
   If a <> "" Then
    Text1 = a
    Text9 = a
   End If
For I = 1 To 20
     If Mid$(Text1.Text, I, 1) = "A" Then
    If Mid$(Text1, I + 4, 1) = "B" Then
        Text5.Text = Val(Mid$(Text1.Text, I + 1, 3))
    End If
    End If
    If Mid$(Text1.Text, I, 1) = "B" Then
    If Mid$(Text1, I + 4, 1) = "C" Then
        Text4.Text = Val(Mid$(Text1.Text, I + 1, 3))
        If Val(Text5) > 40 Then
        Winsock1.SendData "CC"
        Else
        Winsock1.SendData "DD"
        End If
    
    End If
    End If
    If Mid$(Text1.Text, I, 1) = "C" Then
        If Mid$(Text1, I + 4, 1) = "D" Then
        Text2.Text = Val(Mid$(Text1.Text, I + 1, 3))
    End If
    End If
    
    Next I
   
End Sub


What I have tried:

I have checked for solutions but i am not clear.
Posted
Updated 19-Mar-17 3:55am
v2
Comments
Ralf Meier 19-Mar-17 7:33am    
OK ... you have submitted your VB-Code.
What do you think what should happen now ? Someone translates that for you ?
Or do you stuck at a specific point and you need a specific advice ?
Member 13068800 19-Mar-17 9:00am    
yeah I need to translate the code to vb.net that's where I am stuck
Or give me some idea for translating it
Ralf Meier 19-Mar-17 9:26am    
See the Comment from NotPolitcallyCorrect ...
I suggest you to solve your problems step by step with the code you have.
If you stuck at a specific point you could ask again ... and I'm sure you will get an answer which helps you.
[no name] 19-Mar-17 7:42am    
We aren't a code translation service....
Tosby Odhiambo Joséph 19-Mar-17 10:08am    
What have you tried? Or what is your problem?

1 solution

to give you a beginning :

Mid$(Text,i,1) becomes String.Mid(Text,i,1)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900