VB Text1显示到Text2?
如何写才能实现下面的意思,请VB高手帮写写.先谢谢下面我就不写那么多了反正从1到255Text1输入:A001Text2显示:192.168.0.1Text1输入:A09...
如何写才能实现下面的意思,请VB高手帮写写.先谢谢
下面我就不写那么多了反正从1到255
Text1输入:A001
Text2显示:192.168.0.1
Text1输入:A099
Text2显示:192.168.0.99
Text1输入 A255
Text2显示:192.168.0.255
=================================
Text1输入:B001
Text2显示:192.168.1.1
Text1输入:B099
Text2显示:192.168.1.99
Text1输入:B255
Text2显示:192.168.1.255
=================================
Text1输入:C001
Text2显示:192.168.2.1
Text1输入:C099
Text2显示:192.168.2.99
Text1输入:C255
Text2显示:192.168.2.255
Text1输入字母的后面3位数
Text2网段后面3倍数跟着变 展开
下面我就不写那么多了反正从1到255
Text1输入:A001
Text2显示:192.168.0.1
Text1输入:A099
Text2显示:192.168.0.99
Text1输入 A255
Text2显示:192.168.0.255
=================================
Text1输入:B001
Text2显示:192.168.1.1
Text1输入:B099
Text2显示:192.168.1.99
Text1输入:B255
Text2显示:192.168.1.255
=================================
Text1输入:C001
Text2显示:192.168.2.1
Text1输入:C099
Text2显示:192.168.2.99
Text1输入:C255
Text2显示:192.168.2.255
Text1输入字母的后面3位数
Text2网段后面3倍数跟着变 展开
4个回答
展开全部
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Sub js()
On Error Resume Next
If InStr(1, Text1.Text, "A") Then
Text2.Text = "192.168.0." & Int(Right(Text1.Text, 3))
ElseIf InStr(1, Text1.Text, "B") Then
Text2.Text = "192.168.1." & Int(Right(Text1.Text, 3))
ElseIf InStr(1, Text1.Text, "C") Then
Text2.Text = "192.168.2." & Int(Right(Text1.Text, 3))
End If
End Sub
Private Sub Timer1_Timer()
js
End Sub
两个文本框
一个时钟控件就能看到你要的效果。跟着变换!
就可以看到效果了。
展开全部
'简介明了的代码, 完全符合楼主的要求
Private Sub Command1_Click()
Dim sNum() As String
ReDim sNum(1 To 2)
sNum(1) = Left(Text1.Text, 1)
sNum(2) = Mid(Text1.Text, 2, Len(Text1.Text) - 1)
Select Case sNum(1)
Case Is = "A"
Text2.Text = "192.168.0." & Val(sNum(2))
Case Is = "B"
Text2.Text = "192.168.1." & Val(sNum(2))
Case Is = "C"
Text2.Text = "192.168.2." & Val(sNum(2))
'..其他的依次类推
End Select
End Sub
Private Sub Command1_Click()
Dim sNum() As String
ReDim sNum(1 To 2)
sNum(1) = Left(Text1.Text, 1)
sNum(2) = Mid(Text1.Text, 2, Len(Text1.Text) - 1)
Select Case sNum(1)
Case Is = "A"
Text2.Text = "192.168.0." & Val(sNum(2))
Case Is = "B"
Text2.Text = "192.168.1." & Val(sNum(2))
Case Is = "C"
Text2.Text = "192.168.2." & Val(sNum(2))
'..其他的依次类推
End Select
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Text1_Change()
Dim s1 As Integer, s2 As Integer
Dim a As Integer
If Len(Text1.Text) <> 4 Then Exit Sub
a = Asc(UCase(Left(Text1.Text, 1)))
If a >= 65 And a <= 90 Then
s1 = CStr(a - 65)
Else
MsgBox "输入错误"
Exit Sub
End If
If IsNumeric(Right(Text1.Text, 3)) And Right(Text1.Text, 3) <= "255" Then
s2 = CInt(Right(Text1.Text, 3))
Else
MsgBox "输入错误"
Exit Sub
End If
Text2.Text = "192.168." & CStr(s1) & "." & CStr(s2)
End Sub
Dim s1 As Integer, s2 As Integer
Dim a As Integer
If Len(Text1.Text) <> 4 Then Exit Sub
a = Asc(UCase(Left(Text1.Text, 1)))
If a >= 65 And a <= 90 Then
s1 = CStr(a - 65)
Else
MsgBox "输入错误"
Exit Sub
End If
If IsNumeric(Right(Text1.Text, 3)) And Right(Text1.Text, 3) <= "255" Then
s2 = CInt(Right(Text1.Text, 3))
Else
MsgBox "输入错误"
Exit Sub
End If
Text2.Text = "192.168." & CStr(s1) & "." & CStr(s2)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Text1_Change()
Dim strI As String
Dim strO As String
Dim intM As Integer
Dim strm As String
strI = Trim$(Text1.Text)
If Len(strI) <> 4 Then Exit Sub
strm = Right(strI, 3)
If Not IsNumeric(strm) Then Exit Sub
intM = strm
Select Case UCase(Left(strI, 1))
Case "A"
strO = "192.168." & "0." & intM
Case "B"
strO = "192.168." & "1." & intM
Case "C"
strO = "192.168." & "2." & intM
Case Else
strO = "Undefined"
End Select
Text2.Text = strO
End Sub
Dim strI As String
Dim strO As String
Dim intM As Integer
Dim strm As String
strI = Trim$(Text1.Text)
If Len(strI) <> 4 Then Exit Sub
strm = Right(strI, 3)
If Not IsNumeric(strm) Then Exit Sub
intM = strm
Select Case UCase(Left(strI, 1))
Case "A"
strO = "192.168." & "0." & intM
Case "B"
strO = "192.168." & "1." & intM
Case "C"
strO = "192.168." & "2." & intM
Case Else
strO = "Undefined"
End Select
Text2.Text = strO
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询