which textbox is entered?
-
Hi, I'm trying to use the same event for different textboxes - the only difference being the textbox name. Is there a way to determine which textbox the mouse has entered in a MouseEnter event, and then be able to do things with it like
Graphics g = txtBox.CreateGraphics(); SizeF size = g.MeasureString(txtBox.Text,fontsmal);
? Thanks so much again!!! Mel -
Hi, I'm trying to use the same event for different textboxes - the only difference being the textbox name. Is there a way to determine which textbox the mouse has entered in a MouseEnter event, and then be able to do things with it like
Graphics g = txtBox.CreateGraphics(); SizeF size = g.MeasureString(txtBox.Text,fontsmal);
? Thanks so much again!!! Mel -
Yes, the sender paarameter in the event handler is the textbox that sent the event
private void AllTextBoxes_MouseEnter(object sender, MouseEventArgs e) { TextBox tb = sender as textBox; if(tb != null) { // A textbox raised this event } }
-
Hi, I'm trying to use the same event for different textboxes - the only difference being the textbox name. Is there a way to determine which textbox the mouse has entered in a MouseEnter event, and then be able to do things with it like
Graphics g = txtBox.CreateGraphics(); SizeF size = g.MeasureString(txtBox.Text,fontsmal);
? Thanks so much again!!! Mel