I have 9 Text boxex and one command button and I'm looking for a code such that IF i set my cursor on a specific textbox using the mouse then I can be able to Input text in the textbox using the command button.....plea se help..real urgent project.
place text at cursor location
Collapse
X
-
Tags: None
-
-
I have 9 Text boxex and one command button and I'm looking for a code such that IF i set my cursor on a specific textbox using the mouse then I can be able to Input text in the textbox using the command button.....plea se help..real urgent project.
I'm using visual basic....Comment
-
Comment
-
visual basic express edition 2008Comment
-
This can be accomplished using the TextBox's Focused Event and the AddHandler Statement.
For every TextBox that you want to do something when it has focused you will use the AddHandler statement to indicate which method should be called during the Focused event.
-FrinnyComment
-
Following code is storing textbox in a variable when you leave the textbox (that is when you click the button), look at storesctive proc which is handling 4 textboxes leavve event.
Code:Public Class Form1 Private ActiveTextBox As TextBox Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If ActiveTextBox IsNot Nothing Then ActiveTextBox.AppendText("A") ActiveTextBox.Select() End If End Sub Private Sub StoreActive(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Leave, TextBox2.Leave, TextBox3.Leave, TextBox4.Leave ActiveTextBox = DirectCast(sender, TextBox) End Sub End ClassComment
Comment