I'm not exactly sure what the goal of the application is, because I'm not sure what you mean by "formula to subnet." Well, I'm sure they want you to perform some binary calculation on the IP address. Your best bet is probably to use, and possibly extend, the System.Net.IPAddress class. Here's the related page in MSDN: http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemnetipaddressclasstopic.asp.
You can use the IPAddress.Parse() method to accept a standard x.x.x.x IP address format, and then use GetAddressBytes() to get the IP address' four bytes for binary processing.
This was first published in April 2004