符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
Private Sub GetMyIP()
创新互联建站是一家专注于成都网站设计、网站制作与策划设计,嵩明网站建设哪家好?创新互联建站做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:嵩明等地区。嵩明做网站价格咨询:028-86922220
Dim strComputer As String
Dim objWMI As Object
Dim colIP As Object
Dim IP As Object
Dim I As Integer
strComputer = "."
objWMI = GetObject("winmgmts://" strComputer "/root/cimv2")
colIP = objWMI.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IP In colIP
If Not IsNothing(IP.IPAddress) Then
For I = LBound(IP.IPAddress) To UBound(IP.IPAddress)
MsgBox("IP 地址:" IP.IPAddress(I) Chr(10) _
"网卡类型:" IP.Description(I) Chr(10) _
"网卡地址:" IP.Macaddress(I))
Next
End If
Next
End Sub
求行:
RichTextBox1.GetLineFromChar(RichTextBox1.SelStart)+1
这个代码呢,我的理解呢,是获取在selstart的地方的行数。一般来讲selstart的地方都是光标的地方,然后会给你返回line。不过返回的时候要自己加1。不是很懂这个语法,有懂得可以教我一下
以上是求行数。
求列:
For i = 0 To RichTextBox1.SelStart
If RichTextBox1.GetLineFromChar(RichTextBox1.SelStart) - RichTextBox1.GetLineFromChar(RichTextBox1.SelStart - i) 0 Then Exit For
j = j + 1
Next i
这个for循环呢,讲的是检查这一行光标前有多少个列,然后用J输出列的个数。
因为VB6.0没有RichTextBox1.GetFirstCharIndexOfCurrentLine这种语法。所以就得自己模拟这个过程。
具体怎么检查的呢,首先将 i 从0循环到光标处,
如果 【光标字符数】处的行数 减去 【光标字符数减去 i 个字符数】处的行数小于0了,我写了个不为零。但此时写小于零就可以。那么代表着换行了,同时也代表着光标到上一行之间有多少字。用j存储循环次数,得出对应列数。(我们中文习惯是叫第一列,但程序实际上是第零列,但在循环的时候就注意到并解决这个问题了)
如果你替换写法,例如
If RichTextBox1.GetLineFromChar(RichTextBox1.SelStart) - RichTextBox1.GetLineFromChar(RichTextBox1.SelStart + i) 0 Then Exit For
j = j + 1
Next i
这个 J 就对应着光标到该行结尾有几个字符了,如果有需要可以使用,但一般不需要。
那么就像上面说的那样,行列都求出来了,最后用事件和TEXT或者caption表现出来就好了
至于说总行数
RichTextBox1.GetLineFromChar(Len(RichTextBox1.Text)) + 1
通过对最后一个字符的位置(总长度)的行来判断呗,不过也得加一。
.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