473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

place text at cursor location

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.....please help..real urgent project.
Apr 8 '09 #1
7 2692
debasisdas
8,127 Expert 4TB
what is the language that you are using ?
Apr 8 '09 #2
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.....please help..real urgent project.

I'm using visual basic....
Apr 8 '09 #3
debasisdas
8,127 Expert 4TB
@reynolds2007
Which version of visual basic ?

Is it VB 6.0 or any version of VB.net ?
Apr 9 '09 #4
visual basic express edition 2008
Apr 11 '09 #5
Frinavale
9,735 Expert Mod 8TB
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.

-Frinny
Apr 14 '09 #6
aryanbs
42
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.

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1 
  2.     Private ActiveTextBox As TextBox 
  3.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
  4.         If ActiveTextBox IsNot Nothing Then 
  5.             ActiveTextBox.AppendText("A") 
  6.             ActiveTextBox.Select() 
  7.         End If 
  8.     End Sub 
  9.  
  10.     Private Sub StoreActive(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Leave, TextBox2.Leave, TextBox3.Leave, TextBox4.Leave 
  11.         ActiveTextBox = DirectCast(sender, TextBox) 
  12.     End Sub 
  13. End Class 
Apr 14 '09 #7
Frinavale
9,735 Expert Mod 8TB
Oh yeah I forgot about the Handles keyword for methods.

I've been doing everything dynamically for so long now and so I tend to forget the quick/simple way of doing things.

Thanks for that Aryandbs :)
Apr 14 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Paul M. | last post by:
Hi, This might be more of an HTML question, but I'm encountering it via a javascript function. I'm trying to do rollovers without using images. Here's some of the code: <script...
12
by: who be dat? | last post by:
I'm trying to make a webpage do the following: I want a user to be able to click on a given image (there will be more than one image). Upon clicking a given image, characters specific to that...
1
by: oketz1 | last post by:
Hi I am writing an application very similar to notepad and I have to implement the status bar feature, which mean that I have to follow after the cursor is there any event that raised when...
1
by: Roshan | last post by:
Hi All, I am developing an xml editor, inwhich I want to include text auto-completion. When I finish entering start element (ie.<Hello>) on rich text box, the end element (ie.</Hello>) should...
4
by: Strahimir Antoljak | last post by:
I want to track the cursor location relative to a control on the form. I am aware of System.Windows.Forms.Cursor.Position which provides absolute cursor position relative to the screen. With right...
13
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the...
13
by: =?Utf-8?B?S2VzdGZpZWxk?= | last post by:
Hi Our company has a .Net web service that, when called via asp.net web pages across our network works 100%! The problem is that when we try and call the web service from a remote machine, one...
16
Frinavale
by: Frinavale | last post by:
I am just wondering if it is possible to determine where the cursor is located within an <input type='text'> element using JavaScript? I'd like to write a snippet of code that will move to the...
7
prn
by: prn | last post by:
Hi folks, Sometime in the last few days, I must have accidentally done something that changed some kind of switch in Access, but I can't seem to find what it was. This is Access 2003 under XP,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.