Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
select "Obtain DNS Server addresses automatically" in Local Area Connection...


http://upcity.ir/images/83069313380920944438.png[^]
Posted

1 solution

You can use WMI for that. See this article for general interface settings manipulation: Configuring TCP/IP Settings using WMI and C#[^]. Use EnableDHCP[^] method.

[update]
If you don't want to write such "complicated" code, you can also call NETSH. See: http://visibleprocrastinations.wordpress.com/2007/04/20/using-netsh-to-change-between-dhcp-and-static-ips/[^]
 
Share this answer
 
v2
Comments
samadblaj 16-Jan-13 10:08am    
do not using?
Zoltán Zörgő 16-Jan-13 12:42pm    
why not?
Zoltán Zörgő 16-Jan-13 12:56pm    
you can use netsh also. see update.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900