473,507 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auto Select Upon Start

14 New Member
I have created a keyboard program, though I am having one simple problem.

When the program starts I want "Just Type Here!" to appear on the textbox and when you click on a button I want the text to replace the "Just Type Here".

I was thinking I could write a code so that when the program loads it selects the text and when text changes (ie. when a button is pressed and another letter appears) then the "Just Type Here" text will go.

If someone can help me with this I will be really grateful.
Nov 6 '07 #1
12 1488
kadghar
1,295 Recognized Expert Top Contributor
i have created a keyboard program though ...

if someone can help me with this i will be really greatfull
Sure, first of all try making the default text "Just type here"
Check that the EnterFieldBehavior is set as you wish (it's a property of the textbox). If its set "selectAll" when you enter the textbox, it'll select "Just type here" and when you type something it'll be replaced, that'll be a fast way.

Other way is in the TextBox_KeyDown event...you could define a boolean and clear the text box if the boolean is false, also make the boolean true, so it'll clean the textbox only the first time a key is pressed.

There're many other ways. But this should be enoug.

HTH

PS define the boolean outside the sub
Nov 6 '07 #2
moamin123
14 New Member
I am using Visual Basic and I can't find EnterFieldBehavior in the textbox properties.
Nov 6 '07 #3
Killer42
8,435 Recognized Expert Expert
I am using Visual Basic and I can't find EnterFieldBehavior in the textbox properties.
I think we need to know what version of VB.
Nov 6 '07 #4
moamin123
14 New Member
Well, I'm using Visual Studio 2005 so it's Visual Basic 2005.
Nov 6 '07 #5
Killer42
8,435 Recognized Expert Expert
I was thinking I could write a code so that when the program loads it selects the text and when text changes (ie. when a button is pressed and another letter appears) then the "Just Type Here" text will go.
Well, I'm not personally familiar with VB2005, but in VB6 I would put this code in the Form_Load event...
Expand|Select|Wrap|Line Numbers
  1. Text1.SelStart = 1
  2. Text1.SelLength = 500
The "500" can be pretty much anything, as long as it's at least the length of the text.

The "Just Type Here" can be placed in the textbox at design time, of course. And from the sound of it, the EnterFieldBehavior property will achieve the same thing as this code, except every time you enter the field rather than once when the form loads. However, searching the MSDN website and the web in general seems to indicate that it's only applicable in Outlook.
Nov 6 '07 #6
moamin123
14 New Member
nope that doesnt work :(
Nov 6 '07 #7
kadghar
1,295 Recognized Expert Top Contributor
nope that doesnt work :(
did you try the boolean??

Dim boo1 as boolean

And inside the Key Down event of the textbox write:

Expand|Select|Wrap|Line Numbers
  1. if boo1= false then
  2.     boo1=true
  3.     text1.text=""
  4. end if
That should work
Nov 6 '07 #8
YarrOfDoom
1,247 Recognized Expert Top Contributor
As you don't use your keyboard, but buttons on your form, I would add kadghar's code at the end of the code for each clicked-event of your buttons.
Nov 6 '07 #9
moamin123
14 New Member
thanks for all your help but this is getin too complicated 4 me to understand lol
Nov 6 '07 #10
YarrOfDoom
1,247 Recognized Expert Top Contributor
OK, here's an example, see if you can understand it.
(should be placed in Your projects folder of Visual Studio 2005)
Attached Files
File Type: zip WindowsApplication1.zip (50.3 KB, 88 views)
Nov 6 '07 #11
Killer42
8,435 Recognized Expert Expert
nope that doesnt work :(
It certainly will, assuming you get the syntax right for VB2005. It's perfectly simple. When the form is loaded, select the entire text in the textbox.

However, I expect that when adding stuff as the buttons are clicked, you probably should be placing each character in .SelText rather than adding it onto .Text property.
Nov 6 '07 #12
moamin123
14 New Member
thank you soo much i understand wt 2 do nw :D cheers guys
Nov 6 '07 #13

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

Similar topics

12
5629
by: Nick | last post by:
Is it possible to have multiple auto increments in one column? Say I have two tables... 1. table 'messageboards' with fields ('id' , 'name') 2. table 'messagethreads' with fields ('id' ,...
1
2560
by: Ken | last post by:
Need help on the Auto Number or Identity Seed on the Oracle Database I got an Access database that need to be converted to Oracle 9i. Somehow the Trigger we created to simulate the "AUTO NUMBER"...
8
749
by: Bruce Stockwell | last post by:
the setup: Webservice/WinClient application/SQL server. VS.Net (visual basic) winform wizard creates a simple form with load cancel cancelall and datagrid bound to a simple Dataset with one...
6
2341
by: Smithers | last post by:
I am looking to implement a search feature into a Windows Forms MDI application. Specifically I plan to embed 3 textboxes into a toolbar; one for LastName, another for FirstName, and one for...
13
4728
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when...
4
5483
by: Mr. Wilson | last post by:
On this page (just a demo) I can’t get IE6 to auto-select the first item in the dynamically-generated drop-down menus. Well, that isn’t entirely true. Sometimes it works properly, but never on the...
3
7858
by: joseph.mccastlain | last post by:
Hello All, I am a new user to Access. I am currently designing a database consisting of four tables for multiple users. Rather than bore you with the goals and such, here is what I am...
4
14162
by: magmike | last post by:
I've got a control on my form that allows the user to select a record based on a form field (in this example, the drop down menu shows the company name, followed by the contact name but uses the...
2
2675
by: kerriejones | last post by:
I am a bit rusty with my php, but I need to move some code on to a new website and coming upon a lot of problems. This one I can not solvefor the life of me. I am trying to insert a record into a...
0
7223
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
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
5623
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,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.