不能,VB.NET是在windows環(huán)境里開發(fā)windows軟件的,安卓系統(tǒng)用不了,而且也沒安卓版的VB.NET,你要想開發(fā)安卓軟件,先在電腦上安裝JDK環(huán)境包,用Android
專注于為中小企業(yè)提供成都做網(wǎng)站、網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)墨玉免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了近千家企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
Studio來開發(fā),VB.NET就算了。兩者之間壓根就沒關(guān)系。
接收到客戶端數(shù)據(jù),處理完畢........
//返回信息給客戶端
string sendStr = "ok!Client send message successful!";
byte[] bs = Encoding.ASCII.GetBytes(sendStr);
client.Send(bs, bs.Length, 0);
//關(guān)閉套接字
client.Close();
.............客戶端發(fā)送完數(shù)據(jù)等待服務(wù)端返回處理結(jié)果.............
/**/
///接受從服務(wù)器返回的信息
string recvStr = "";
byte[] recvBytes = new byte[1024];
int bytes;
bytes = client.Receive(recvBytes, recvBytes.Length, 0);//從服務(wù)器端接受返回信息
recvStr += Encoding.ASCII.GetString(recvBytes, 0, bytes);
label15.Text = DateTime.Now.ToString() + ":" + recvStr;//顯示服務(wù)器返回信息
///一定記著用完socket后要關(guān)閉
//關(guān)閉套接字
client.Close();
換成USB是一樣的,只看到COM1可能是因?yàn)槟愕碾娔X上只有一個(gè)COM1或者只用了一個(gè)COM1,要想收到數(shù)據(jù)得有數(shù)據(jù)網(wǎng)這個(gè)串口上發(fā)送才行的;并且要保證串口已經(jīng)打開而且設(shè)置了端口號(hào)和波特率校驗(yàn)等參數(shù)才行的
你可以定義一個(gè)數(shù)組,其中每一個(gè)元素都是一個(gè)結(jié)構(gòu),在每一個(gè)結(jié)構(gòu)中存放每一個(gè)人的姓名、年齡等信息。這需要用到類。
創(chuàng)建類,然后定義結(jié)構(gòu)中包含的所有數(shù)據(jù),然后在程序中創(chuàng)建數(shù)組,定義每一個(gè)數(shù)組的元素都是一個(gè)這樣的類,并且在定義后使用New子句將其實(shí)力化.關(guān)于類,你可以參考你的學(xué)習(xí)用書,定義應(yīng)該不成問題,關(guān)鍵看這種思路吧.
例如定義類,內(nèi)容:
Public Class VarClass
Public Class Student
Public Name As String
Public NamePass As String
Public Number As UInt16
Public Dis, Stu As New Collection
Public ToDis, ToStu As Decimal
End Class
End Class
然后在程序代碼中:Public People(10) As Object
注意一定要先定義Object,因?yàn)閿?shù)組無法使用New子句
然后實(shí)例化:
For a = 0 To (My.Forms.Form1.StuNum - 1)
People(a) = New VarClass.Student
Next
定義完成!
For a=0 to 10 do
If People(a).Name=Name(選中的名字) then
textbox1.text=People(a).Age
exit for
End if
然后根據(jù)ListBox中選中項(xiàng)的Text,使用For.Each(在數(shù)量無法確定的情況下)或者For.do語句,遍歷數(shù)組中每個(gè)元素,即結(jié)構(gòu)中的姓名域,如果找到,就把該結(jié)構(gòu)中的其它幾項(xiàng)內(nèi)容分別賦給TextBox的Text,并且用Exit For跳出For語句.
成功!
用 vb.net socket通信
Dim th As Threading.Thread
2 Dim tcpl As System.Net.Sockets.TcpListener
3
4 Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
5 th = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf MyListen))
6 th.Start()
7 End Sub
8
9 Public Sub SendMessage()Sub SendMessage(ByVal IP As String, ByVal SendMsg As String)
10 Try
11 If IP "" Then
12 Dim tcpc As New System.Net.Sockets.TcpClient(IP, 5656)
13 Dim tcpStream As Net.Sockets.NetworkStream = tcpc.GetStream
14 Dim reqStream As New IO.StreamWriter(tcpStream)
15 reqStream.Write(SendMsg)
16 reqStream.Flush()
17 tcpStream.Close()
18 tcpc.Close()
19 End If
20 Catch ex As Exception
21 MsgBox(ex.Message.ToString)
22 End Try
23 End Sub
24 Private Sub MyListen()Sub MyListen()
25 Try
26 Dim ipAddress As System.Net.IPAddress = System.Net.Dns.Resolve(System.Net.Dns.GetHostName).AddressList(0)
27 tcpl = New System.Net.Sockets.TcpListener(ipAddress, 5656)
28 tcpl.Start()
29 While True
30 Dim s As System.Net.Sockets.Socket = tcpl.AcceptSocket()
31 Dim MyBuffer(1024) As Byte
32 Dim i As Integer
33 i = s.Receive(MyBuffer)
34 If i 0 Then
35 Dim lstrRec As String
36 Dim j As Integer
37 For j = 0 To i - 1
38 TextBox1.Text += Chr(MyBuffer(j)) ","
39 Next
40 End If
41 End While
42 Catch ex As Exception
43 MsgBox(ex.Message.ToString)
44 End Try
45 End Sub
46
47 Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
48 SendMessage("192.168.0.61", TextBox2.Text)
49 End Sub
在工程里面建立一個(gè)VS自帶的本地?cái)?shù)據(jù)庫,用數(shù)據(jù)庫來操作要方便得多,追求性能的話,圖片單獨(dú)創(chuàng)建一個(gè)圖片目錄來存放,數(shù)據(jù)庫里面存入圖片鏈接,如果圖片需要保密,那就直接放到數(shù)據(jù)庫。
用Excel操作也是可以的,引用Microsoft.Office.Tools.Excel,然后在VB.NET里面對(duì)Exce進(jìn)行修改,圖片的話,創(chuàng)建一個(gè)圖片目錄,Excel存入圖片名稱,在代碼里面對(duì)目錄下的名稱進(jìn)行匹配,讀取到ListView,我電腦上沒裝Excel沒法給你寫相關(guān)Excel的代碼示例!