السلام عليكم ..
السؤال: هو انه لدينا button , textbox وعندما ندخل الارقام في textbox ويعدها نضغط على الbutton تظهر لنا عبارة تبين لنا ان ip address الذي ادخلناه في textbox يكون هو صحيح او غير صحيح فاذا كان موجود يظهر في ip address والا not ip address .. فارجو مساعدتي في الحل..
PHP كود :
private void button1_Click(object sender, EventArgs e)
{
string s;
int count;
string str ="";
string temp ="";
for (int i = 0; i < str.Length; ++i)
{
s = s + str[i];
if (str[i] == '.')
{
if ((Convert.ToInt32(s)>= 0) && (Convert.ToInt32(s)<= 255))
{
count++;
s = "";
}
else
{
temp += str[i].ToString();
}
if (count == 4)
{
MessageBox.Show( "IP address");
}
else
{
MessageBox.Show("IP address");
}
}
}
}
}
}