Click here to Skip to main content
12,065,045 members (45,457 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
select "Obtain DNS Server addresses automatically" in Local Area Connection...


http://upcity.ir/images/83069313380920944438.png[^]
Posted 16-Jan-13 4:56am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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/[^]
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160204.4 | Last Updated 16 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100