成都创新互联网站制作重庆分公司

vb.netntp的简单介绍

vb和vb.net的区别和特点

1、vb.net  完全符合面向对象的编程语言抽象、封装、继承的四大特性,而vb不支持继承。

成都创新互联公司-专业网站定制、快速模板网站建设、高性价比天全网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式天全网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖天全地区。费用合理售后完善,10年实体公司更值得信赖。

2、错误处理不同。

vb中只是On Error.....goto和On Errer Resume Next ,这些错误称为非结构化异常处理。而在vb.net中采用的结构化异常处理机制,try...catch....finally控制。

3、两者产生的窗体不同。

vb.net 允许创建不同类型的应用程序,例如,创建ASP.NET和ASP.NET Web 服务应用程序,还允许创建控制台应用程序和作为桌面服务运行的应用程序。但是vb 只能创建Windows窗体。

4、数据库访问的差别。

vb6.0是通过ADO(Active X Data Objext)来实现对数据库访问。而vb.net 是通过ADO.NET来访问数据库。

扩展资料

Visual Basic(简称VB)是Microsoft公司开发的一种通用的基于对象的程序设计语言,为结构化的、模块化的、面向对象的、包含协助开发环境的事件驱动为机制的可视化程序设计语言。是一种可用于微软自家产品开发的语言。

“Visual” 指的是开发图形用户界面 (GUI) 的方法——不需编写大量代码去描述界面元素的外观和位置,而只要把预先建立的对象add到屏幕上的一点即可。

“Basic”指的是 BASIC (Beginners All-Purpose Symbolic Instruction Code) 语言,是一种在计算技术发展历史上应用得最为广泛的语言。

Visual Basic源自于BASIC编程语言。VB拥有图形用户界面(GUI)和快速应用程序开发(RAD)系统,可以轻易的使用DAO、RDO、ADO连接数据库,或者轻松的创建Active X控件,用于高效生成类型安全和面向对象的应用程序 。

参考资料:百度百科-Visual Basic

用vb.net实现网络通信

用 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

Vb.net 2008 如何获取网络时间

你是指Internet上的国际标准时间吗。

先加入控件 AxWinsock1 在.Com中Microsoft.Winsock

Public Class Form1

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Integer)

Dim NoSrv As Boolean

Dim TimeFromNet As String

Dim OldTime As Date

Dim NewTime As Date

Dim MyDate As Date

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If AxWinsock1.CtlState MSWinsockLib.StateConstants.sckClosed Then AxWinsock1.Close()

AxWinsock1.Protocol = MSWinsockLib.ProtocolConstants.sckTCPProtocol

NetTime("") '首先取中科院国家授时中心时间

If NoSrv Or TimeFromNet = "" Then

NetTime("time.nist.gov") '取美国标准技时院时间

If NoSrv Or TimeFromNet = "" Then

MsgBox("检测不到网络标准时间服务器time.nist.gov!")

Else

NetTime("time.nist.gov")

If TimeFromNet = "" Then

MsgBox("网络标准时间服务器time.nist.gov超时!")

Else

MyDate = Mid(TimeFromNet, 8, 8)

OldTime = Mid(TimeFromNet, 17, 8)

NewTime = TimeSerial((Hour(OldTime) + 8) Mod 24, Minute(OldTime), Second(OldTime))

Dim MyTime As DateTime = MyDate Space(1) NewTime

MsgBox(MyTime)

'SetWindowsClock(MyTime)

End If

End If

Else

'使网络误差时间小,第2次再中科院国家授时中心时间

NetTime("")

If TimeFromNet = "" Then

MsgBox("网络标准时间服务器超时!")

Else

MyDate = Mid(TimeFromNet, 8, 8)

NewTime = Mid(TimeFromNet, 17, 8)

Dim MyTime As DateTime = MyDate Space(1) NewTime

MsgBox(MyTime)

'SetWindowsClock(MyTime)

End If

End If

End Sub

Private Sub NetTime(ByVal TimeSrv As String)

NoSrv = False

TimeFromNet = ""

If AxWinsock1.CtlState MSWinsockLib.StateConstants.sckClosed Then AxWinsock1.Close()

AxWinsock1.RemoteHost = TimeSrv ' "" 或 "time.nist.gov"

AxWinsock1.RemotePort = 13

AxWinsock1.LocalPort = 0

AxWinsock1.Connect()

Do While TimeFromNet = ""

If NoSrv Then Exit Do

Sleep(55)

System.Windows.Forms.Application.DoEvents()

Loop

If AxWinsock1.CtlState MSWinsockLib.StateConstants.sckClosed Then AxWinsock1.Close()

End Sub

Private Sub AxAxWinsock1_CloseEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxWinsock1.CloseEvent

AxWinsock1.Close()

End Sub

Private Sub AxAxWinsock1_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles AxWinsock1.DataArrival

AxWinsock1.GetData(TimeFromNet)

End Sub

Private Sub AxAxWinsock1_Error(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_ErrorEvent) Handles AxWinsock1.Error

NoSrv = True

End Sub

End Class


网页名称:vb.netntp的简单介绍
标题网址:http://cxhlcq.com/article/dopohoo.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部