C 建立使用者控制項 IPv4位址輸入框

2021-09-08 04:10:31 字數 1851 閱讀 6790

根據網上的改寫:

控制項屬性:

borderstyle:獲取或設定控制項的邊框樣式。

validateip() 判斷ip是否有效
using

system;

using

system.collections.generic;

using

system.componentmodel;

using

system.drawing;

using

system.data;

using

system.windows.forms;

using

system.text.regularexpressions;

using

system.net;

namespace

fvd.common

;

public

class

ipaddresstextbox : usercontrol

base

.dispose(disposing);

}#region 元件設計器生成的**

//////設計器支援所需的方法 - 不要

///使用**編輯器修改此方法的內容。

/// private

void

initializecomponent()

#endregion

public

ipaddresstextbox()

private

void ipv4textbox_keypress(object

sender, keypresseventargs e)

");}

e.handled = true

; }

if (regex.match(keychar.tostring(), "

[0-9]

").success)

}else

if (textlength == 0

) }}

else");

} }}

else}}

//////

string型別的ip位址

/// override

public

string

text

set } }}

//////

ip位址

/// public

ipaddress value

else

}set }

}//////

ip位址分類

/// public

iptype type

else

if (firstbyte < 192

)

else

if (firstbyte < 224

)

else

if (firstbyte < 240

)

else}}

public

bool

validateip()

//////

控制項的邊框樣式

/// new

public

borderstyle borderstyle

set }}}

}

IPV4位址分類

昨天去做上海 交易所的筆試題時,碰到了這一道題,現整合下手頭的資源,好好闡述這道題。ipv4是網際網路協議的第4版 v代表version,版本之意 也是第乙個被廣泛使用,構成現今 網際網路技術 的基礎的協議。目前的全球 網際網路所採用的協議族是 tcp ip協議族 ip是tcp ip協議族中網路層的...

IPv4 位址分類

d類 組播 11100000 11101111 224 239 e類 240 255 私網id 與私有ip位址對應的是公有位址 public address 由inter nic internet network information center 網際網路資訊中心 負責。這些ip位址分配給註冊並...

ipv4位址分類

ipv4位址分類 a類位址 1 a類位址第1位元組為網路位址,其它3個位元組為主機位址。b類位址 1 b類位址第1位元組和第2位元組為網路位址,其它2個位元組為主機位址。3 b類位址的私有位址和保留位址 172.16.0.0 172.31.255.255是私有位址 169.254.x.x是保留位址。...