Icon in a textbox
-
I have a type ahead textbox and on each key press I post back to the server. while the textbox is waiting for the results I would like to display a spinner icon next to the text in the textbox. this spinner icon would indicate that the textbox is waiting for the results. I have looked at various properties of the text box and couldn’t any property which would allow me to do that. any suggestions would be appreciated.. thanks, kar
-
I have a type ahead textbox and on each key press I post back to the server. while the textbox is waiting for the results I would like to display a spinner icon next to the text in the textbox. this spinner icon would indicate that the textbox is waiting for the results. I have looked at various properties of the text box and couldn’t any property which would allow me to do that. any suggestions would be appreciated.. thanks, kar
I would recommend you look at the AJAX tool kit and use an update panel with an update progress control and respond to the textbox.textchanged event. You may have to set auto postback to true on it as well. This article may help for the AJAX peice. The UpdateProgress Control of ASP.NET AJAX Extensions[^] Hope this helps.
-
I would recommend you look at the AJAX tool kit and use an update panel with an update progress control and respond to the textbox.textchanged event. You may have to set auto postback to true on it as well. This article may help for the AJAX peice. The UpdateProgress Control of ASP.NET AJAX Extensions[^] Hope this helps.
-
Thanks for the info.. The Text box i wam working on is Winforms textbox. Is there a similar thing that works in a Winforms environment.. Thanks kar
Oh I thought you were using ASP.NET since you were sending back to server (what I get for assuming)... You can still respond to the TextBox.TextChanged event. This fires after any input into the textbox. You can use an animated gif to put into an image control to be visible while you are performing whatever operation during the event and set it to visible = false when your processing is complete.
private void currencyTextBox_TextChanged(object sender, EventArgs e)
{
imageProgress.Visible = true;
Application.DoEvents();... // Processing imageProgress.Visible = false; Application.DoEvents();
}
You may have an issue with setting the visiblilty in the current thread... the Application.DoEvents() may solve that, but may not, you may need to look at doing the proccessing on a different thread, you could use a backgroundworker for doing that and it is fairly easy to implement. Hope this helps.
-
Oh I thought you were using ASP.NET since you were sending back to server (what I get for assuming)... You can still respond to the TextBox.TextChanged event. This fires after any input into the textbox. You can use an animated gif to put into an image control to be visible while you are performing whatever operation during the event and set it to visible = false when your processing is complete.
private void currencyTextBox_TextChanged(object sender, EventArgs e)
{
imageProgress.Visible = true;
Application.DoEvents();... // Processing imageProgress.Visible = false; Application.DoEvents();
}
You may have an issue with setting the visiblilty in the current thread... the Application.DoEvents() may solve that, but may not, you may need to look at doing the proccessing on a different thread, you could use a backgroundworker for doing that and it is fairly easy to implement. Hope this helps.
This one helps.. but the imagecontrol is seperate from the textbox. In my scenario the image control is inside the textbox. more specifically on the right most side of the textbox where its spinning while waiting for the results to come back.. Could u let me know how I could tie up the image control inside the textbox. Thanks, kar
-
This one helps.. but the imagecontrol is seperate from the textbox. In my scenario the image control is inside the textbox. more specifically on the right most side of the textbox where its spinning while waiting for the results to come back.. Could u let me know how I could tie up the image control inside the textbox. Thanks, kar
try using your own user control that contains textbox and image control, add event begin and end progress to trigger visibility of your image control hope it helps
dhaim ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro" in the front line gave a lead, in the middle line build goodwill, in the behind give power support
-
This one helps.. but the imagecontrol is seperate from the textbox. In my scenario the image control is inside the textbox. more specifically on the right most side of the textbox where its spinning while waiting for the results to come back.. Could u let me know how I could tie up the image control inside the textbox. Thanks, kar
You could do something like this. Not perfect or complete but should be a start.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;public class BusyTextBox : TextBox
{
private Image busyImage;
private bool isBusy;public Image BusyImage { get { return busyImage; } set { busyImage = value; } } \[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)\] public bool IsBusy { get { return isBusy; } private set { isBusy = value; if (value) { using (Graphics g = this.CreateGraphics()) { // draw image // g.DrawImage(busyImage, } } else { Invalidate(); } } } protected override void OnTextChanged(EventArgs e) { IsBusy = true; // Do Your DB Stuff base.OnTextChanged(e); IsBusy = false; }
}
Make sure you dispose of the busyImage if not null when the BusyTextBox is disposed!
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus) -
This one helps.. but the imagecontrol is seperate from the textbox. In my scenario the image control is inside the textbox. more specifically on the right most side of the textbox where its spinning while waiting for the results to come back.. Could u let me know how I could tie up the image control inside the textbox. Thanks, kar