How to trim IP Address to get the first 3 parts of it?
String result = input.Substring(0, input.LastIndexOf("."));
Using String.LastIndexOf(), it should be easy.
EDIT
Using that method you can locate the last '.'. Then you need a substring up to and (apparently) incuding that '.'. Something like:
string shortened = longIP.Substring(0,longIP.LastIndexOf(".")+1);
string ip= "192.168.1.100";
string partial = ip.Substring(0,ip.LastIndexOf("."));