If InStr(InStr(InStr(Text1.Text, ".") + 1, Text1.Text, ".") + 1, Text1.Text, ".") > 0 Then
If Text4.Text <> "" Then
Shell "cmd /c netsh -c interface ip set wins name= " & Chr(34) & "本地連接" & Chr(34) & " source=static add=none", vbHide
'設置ip地址
Shell "cmd /c netsh -c interface ip set address name= " & Chr(34) & "本地連接" & Chr(34) & " source=static add=" & Text1.Text & " mask=" & Text2.Text, vbHide
'::設置子網掩碼:
Shell "cmd /c netsh -c interface ip set address name= " & Chr(34) & "本地連接" & Chr(34) & " gateway=" & Text3.Text & " gwmetric=1", vbHide
':: 設置網關
Shell "cmd netsh -c interface ip set dns name= " & Chr(34) & "本地連接" & Chr(34) & " source=static add=" & Text4.Text & " register=PRIMARY", vbHide
':: 設置主dns
Shell "cmd /c netsh -c interface ip add dns name= " & Chr(34) & "本地連接" & Chr(34) & " add=" & Text5.Text & " index=2", vbHide
'設置備份DNS
MsgBox "填寫成功", 64, "確定"
Else
MsgBox "錯誤的DNS 服務,請重新輸入!", 64, "錯誤"
Text4.SetFocus
SendKeys "{Home}+{End}"
End If
Else
MsgBox "錯誤的IP地址,請重新輸入!", 64, "錯誤"
Text1.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub