VB.NET的等效代码 [英] Equivalent code for VB.NET

查看:83
本文介绍了VB.NET的等效代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是VB.NET的新手,我正在做VB.NET的最后一年项目。我已经完成了一半的应用程序,但我不知道如何通过wifi将at89s52与我的应用程序接口。我有一个用VB6编写的应用程序,这个应用程序将通过wifi连接套件,并从at89s52微控制器获取值。我有代码来连接它,但它是在vb6上编写的,我不知道如何在VB.NET中编写一个等效的代码。



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.

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.

推荐答案

(Text1.Text,I, 1 )= 然后
' 如果Mid
(Text1.Text, I, 1) = "A" Then ' If Mid


(Text1, I + 4,1)=V然后
Text5.Te xt = Val(Mid
(Text1, I + 4, 1) = "V" Then Text5.Text = Val(Mid


(Text1.Text,I + 1 3 ))
' 结束如果
结束 如果
如果 Mid
(Text1.Text, I + 1, 3)) ' End If End If If Mid


这篇关于VB.NET的等效代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆