Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 136,231 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,290 people online right now. Registration is fast and FREE... Join Now!




Only Entering in one text box

 
Reply to this topicStart new topic

Only Entering in one text box, how to make button typing enter in the text box the cursor is in.

technoatticus
10 Oct, 2008 - 12:23 PM
Post #1

New D.I.C Head
*

Joined: 10 Oct, 2008
Posts: 4

First Post (: so sorry to seem like such the beginner i am, i have a simple request.
I'm making a calculator for computing homework, using a 2 text field entry system.
I dont know how to make the buttons enter the characters in the text box the cursor is in, at the moment it automatically does 1 because of the code, help much appreciated.
For eg, buttons representing 3, and 4, codes of which are:

CODE


    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        TextBox1.Text = TextBox1.Text + "3"
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        TextBox1.Text = TextBox1.Text + "4"
            End Sub


This post has been edited by technoatticus: 10 Oct, 2008 - 12:29 PM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Only Entering In One Text Box
10 Oct, 2008 - 12:46 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Moved to the VB.NET forum smile.gif
User is offlineProfile CardPM
+Quote Post

Qball522
RE: Only Entering In One Text Box
10 Oct, 2008 - 01:02 PM
Post #3

D.I.C Head
**

Joined: 6 Oct, 2008
Posts: 54

From what I understand you are trying to make buttons the will input the numbers directly into a TextBox.

If that is what you are trying to do then the code would be

CODE

Textbox1.text = 3


in your button 3 click event.

O.o I see what you mean now, Beginner here as well. Someone with far more knowledge than I will ave to help with this one.

This post has been edited by Qball522: 10 Oct, 2008 - 01:23 PM
User is offlineProfile CardPM
+Quote Post

gbertoli3
RE: Only Entering In One Text Box
10 Oct, 2008 - 01:41 PM
Post #4

DIC at Heart + Code
Group Icon

Joined: 23 Jun, 2008
Posts: 1,046



Thanked: 17 times
Dream Kudos: 950
My Contributions
Try This
vb

If TextBox1.Focused = True Then
'Your Code Here
End If


Hope this helps
User is offlineProfile CardPM
+Quote Post

gabehabe
RE: Only Entering In One Text Box
10 Oct, 2008 - 02:09 PM
Post #5

Donkey DIC
Group Icon

Joined: 6 Feb, 2008
Posts: 5,522



Thanked: 96 times
Dream Kudos: 2650
Expert In: ruling the world.

My Contributions
What exactly are you looking to do? I read, and re-read your post a dozen times and I just couldn't understand the wording~ probably because I'm kinda tired sleeping.gif
User is offlineProfile CardPM
+Quote Post

technoatticus
RE: Only Entering In One Text Box
10 Oct, 2008 - 02:46 PM
Post #6

New D.I.C Head
*

Joined: 10 Oct, 2008
Posts: 4

QUOTE(PsychoCoder @ 10 Oct, 2008 - 01:46 PM) *

Moved to the VB.NET forum smile.gif


thankyou smile.gif
User is offlineProfile CardPM
+Quote Post

technoatticus
RE: Only Entering In One Text Box
10 Oct, 2008 - 02:59 PM
Post #7

New D.I.C Head
*

Joined: 10 Oct, 2008
Posts: 4

QUOTE(gbertoli3 @ 10 Oct, 2008 - 02:41 PM) *

Try This
vb

If TextBox1.Focused = True Then
'Your Code Here
End If


Hope this helps


This code just stops the flashing of the cursor in the text box, as though it has been deselected.
I'd show a picture but my connection is playing right up, sorry.
Imagine 2 text boxes, 1set of buttons. no matter which texbox cursor is in, buttons enter numbers into textbox1, that's the problem.
User is offlineProfile CardPM
+Quote Post

gbertoli3
RE: Only Entering In One Text Box
10 Oct, 2008 - 03:09 PM
Post #8

DIC at Heart + Code
Group Icon

Joined: 23 Jun, 2008
Posts: 1,046



Thanked: 17 times
Dream Kudos: 950
My Contributions
The reason why it is deselecting is because you pressed a button, thus giving focus to another control. If you were to do the same thing without any code it would deselect it as well.
User is offlineProfile CardPM
+Quote Post

Qball522
RE: Only Entering In One Text Box
10 Oct, 2008 - 04:30 PM
Post #9

D.I.C Head
**

Joined: 6 Oct, 2008
Posts: 54

I understand what they are trying to do, that doesn't mean I know the answer.

Instead of using the NumPad they want to have 10 buttons with a number for each, 0, 1, 2, ect.

When they click on one of the numbers it inputs it to the textboxes ie. 3345

Getting that into textbox1 is not a problem but getting it to go into textbox2 is. Using the code they have provided.


They need to know how to have the cursor in textbox2 and have it enter the number buttons you click on go into textbox2.


User is offlineProfile CardPM
+Quote Post

gbertoli3
RE: Only Entering In One Text Box
10 Oct, 2008 - 09:36 PM
Post #10

DIC at Heart + Code
Group Icon

Joined: 23 Jun, 2008
Posts: 1,046



Thanked: 17 times
Dream Kudos: 950
My Contributions
Here maybe this will help you.
http://www.dreamincode.net/forums/showtopic32951.htm
User is offlineProfile CardPM
+Quote Post

technoatticus
RE: Only Entering In One Text Box
11 Oct, 2008 - 08:40 AM
Post #11

New D.I.C Head
*

Joined: 10 Oct, 2008
Posts: 4

thanks everyone for the help, the guide should have enough information in it to find a way around (:
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 03:23AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month