PDA

View Full Version : سوال: کار با tooltip و مقادیر عددی



علی فتحی
یک شنبه 25 خرداد 1393, 00:44 صبح
سلام وخسته نباشید.
برای جداکردن اعداد بصورت 3 رقم این کدو نوشتم .
و اونو توی تول تیپ هم نشون دادم با این کد.حالا سوال.اگه استادان گرامی تونستن .من میخوام عمل جدا کننده فقط توی تول تیپ نشون داده بشه . معدد تکس باکس معمولی مثل خودش نوشته بشه
کدو تغییر بدن ممنون میشم.

private void textBox1_TextChanged(object sender, EventArgs e)
{
ToolTip toolTip1 = this.toolTip1;
if (!string.IsNullOrEmpty(textBox1.Text))
{
textBox1.Text = string.Format("{0:n0}",
double.Parse(textBox1.Text.Replace(",", "")));
textBox1.Select(textBox1.Text.Length, 0);
toolTip1.Show(textBox1.Text, textBox1);
}
}

hamid_hr
یک شنبه 25 خرداد 1393, 08:44 صبح
string tmp = string.Format("{0:n0}", double.Parse(textBox1.Text.Replace(",", "")));
toolTip1.Show(tmp, textBox1);

علی فتحی
یک شنبه 25 خرداد 1393, 23:13 عصر
تشکر از توجه هتون به سوال ولی با کد سی شارپ میخواستم

Share & Learn
یک شنبه 25 خرداد 1393, 23:24 عصر
سلام
خدمت شما...


private void textBox1_TextChanged(object sender, EventArgs e)
{
ToolTip toolTip1 = this.toolTip1;
if (!string.IsNullOrEmpty(textBox1.Text))
{
string str = string.Format("{0:n0}", double.Parse(textBox1.Text.Replace(",", "")));
textBox1.Select(str.Length, 0);
toolTip1.Show(str, textBox1);
}
}