新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Sub Command1_Click() strIP = "127.0.0.1" pos = InStrRev(strIP, ".") strIP = Left(strIP, pos) + "255" MsgBox strIP End Sub
运行结果:
127.0.0.255