Display a text box formatted for filling

Asked

Viewed 33 times

0

Good morning Gentlemen, I’ve searched the entire Internet, but I don’t think I know how to express myself, so I’ve come to ask you... I have a VB command to change the ip of Win7 but I would like the command to ask which ip I would like to put following command...

' ## Script para alterer ip da Placa de Rede ##

Set objWMIService = GetObject("winmgmts:\.\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

strIPAddress = Array("10.10.0.7") 'Coloque o IP fixo
strSubnetMask = Array("255.255.255.0") 'Coloque a Mascara de SubNet

strGateway = Array("10.1.1.1") 'Coloque o Gateway
strGatewayMetric = Array(1)

strDNS = Array("200.204.0.10","200.204.0.138") 'Coloque o IP DNS

For Each objNetAdapter in colNetAdapters
    errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
    errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
    objNetAdapter.SetDNSServerSearchOrder strDNS
Next

In part strIPAddress = Array("10.10.0.7") 'Coloque o IP fixo would like to open a text box for the user to change the end or if it is not possible the whole ip, for example:

10.10.0.___
  • To display a custom text box you can use the "Microsoft Maked Edit Control" component, with it you can create masks for the text.

1 answer

0

The simplest way is to use an inputbox. Example:

ip = InputBox("Coloque o IP fixo", "Mudar IP")

Another way more laborious but that would bring better aesthetic results would be to make a form and call it returning the result to its variable.

  • strIPAddress = Array Inputbox("Description phrase", "Box title") 'Set fixed IP

  • this way I didn’t understand very well?

  • I changed it to be clearer

  • Good if I understood would be like this

  • strIPAddress = Inputbox("Set fixed IP", "Change IP")

  • I’ll be honest not my beach vbs

  • yes, that is, the text box will appear with the title change ip and a written description put the fixed ip next to an input and the ok and cancel buttons

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.