关于vb.net连接采集卡的信息

用vb.net实现网络通信

用 vb.net socket通信

创新互联建站主营昆山网站建设的网络公司,主营网站建设方案,重庆APP开发,昆山h5微信小程序开发搭建,昆山网站营销推广欢迎昆山等地区企业咨询

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

vb.net实现实时数据采集曲线,有什么方法,或是书籍呢?

简单说下思路吧,具体的代码可以查资料

首先要会画曲线图,有三种方法:

1、用mschar控件(vb6的);2、用水晶报表;3、用word图表

x轴为时间,y轴为数据

要实现实时数据刷新,只要用 定时器 定时刷新曲线图的数据就可以了(x、y的数据重写)

VB.NET怎么调用摄像头啊?求实例,最好配注释啊

Private Const WS_CHILD = H40000000

Private Const WS_VISIBLE = H10000000

Private Const WM_CAP_START = H400

Private Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10

Private Const WM_CAP_SET_SCALE = WM_CAP_START + 53

Private Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52

Private Const WM_CAP_SET_PREVIEW = WM_CAP_START + 50

Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" ( _

ByVal lpszWindowName As String, _

ByVal dwStyle As Long, _

ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, _

ByVal hWndParent As Long, ByVal nID As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long

Private Sub Form_Load()

'建立采集窗口(不显示窗口,处理后显示到PIC控件)

uwndc = capCreateCaptureWindowA("", WS_VISIBLE Or WS_CHILD, 0, 0, 320, 240, Me.hWnd, 0)

'连接

SendMessage uwndc, WM_CAP_DRIVER_CONNECT, 0, 0

'Scale开

SendMessage uwndc, WM_CAP_SET_SCALE, True, 0

'显示刷新MS

SendMessage uwndc, WM_CAP_SET_PREVIEWRATE, 40, 0

'用予览方式显示(特殊需要,不显示予缆)

SendMessage uwndc, WM_CAP_SET_PREVIEW, True, 0

End Sub

上述代码就可以实现 但是要注意相应的控件是否存在 不存在的 你自己画出来

vb.net 检测网络连接

既然从网上找的实例没问题,也许就是调用的时候没出来或者在检测网卡当中出现了问题。

vb.net 获取指定网卡的网络连接状态

.net不能获得【指定】网卡的信息,给个思路,先遍历所有网卡,然后找到你需要的的那个网卡的信息。

vb.net的数据库连接

1·绑定数据源来进行连接

2.用代码连接

先到数据库建立一个数据库和相应的表

连接数据库的代码:

Dim str As String = "Data Source=服务器名;Initial Catalog=数据库名;Persist Security Info=True;User ID=;Password="

dim conn As SqlClient.SqlConnection

try

conn = New SqlClient.SqlConnection

conn.ConnectionString = str

conn.Open()

Return True

Catch ex As Exception

MsgBox(ex.ToString)

Return False

End Try

登录代码:Dim str As String = "Data Source=服务器名;Initial Catalog=数据库名;Persist Security Info=True;User ID=;Password="

dim conn As SqlClient.SqlConnection

conn = New SqlClient.SqlConnection

conn.ConnectionString = str

conn.Open()

sqlstr = "Select * From Amd Where AmdName='" TextBox1.Text "' And AmdPwd = '" TextBox2.Text "'"

Dim sqlcmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlstr, conn)

Dim dr As SqlClient.SqlDataReader

dr = sqlcmd.ExecuteReader

If dr.Read = True Then '判断一条记录为真

kf.Show() '显示下个窗体

Me.Hide() ’隐藏当前窗体

Else

MessageBox.Show("输入信息有误!", "提示")

TextBox1.Text = ""

TextBox2.Text = ""

End If


网站栏目:关于vb.net连接采集卡的信息
转载源于:http://scyanting.com/article/dodsijo.html