Only Entering in one text box

how to make button typing enter in the text box the cursor is in.

Page 1 of 1

10 Replies - 2055 Views - Last Post: 11 October 2008 - 09:40 AM Rate Topic: -----

#1 technoatticus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-October 08

Only Entering in one text box

Posted 10 October 2008 - 01:23 PM

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:


	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 October 2008 - 01:29 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Only Entering in one text box

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Only Entering in one text box

Posted 10 October 2008 - 01:46 PM

Moved to the VB.NET forum :)
Was This Post Helpful? 0
  • +
  • -

#3 Qball522  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 86
  • Joined: 06-October 08

Re: Only Entering in one text box

Posted 10 October 2008 - 02:02 PM

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

 
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 October 2008 - 02:23 PM

Was This Post Helpful? 0
  • +
  • -

#4 gbertoli3  Icon User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 40
  • View blog
  • Posts: 1,162
  • Joined: 23-June 08

Re: Only Entering in one text box

Posted 10 October 2008 - 02:41 PM

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



Hope this helps
Was This Post Helpful? 0
  • +
  • -

#5 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1382
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: Only Entering in one text box

Posted 10 October 2008 - 03:09 PM

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 :zzz:
Was This Post Helpful? 0
  • +
  • -

#6 technoatticus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-October 08

Re: Only Entering in one text box

Posted 10 October 2008 - 03:46 PM

View PostPsychoCoder, on 10 Oct, 2008 - 01:46 PM, said:

Moved to the VB.NET forum :)


thankyou :)
Was This Post Helpful? 0
  • +
  • -

#7 technoatticus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-October 08

Re: Only Entering in one text box

Posted 10 October 2008 - 03:59 PM

View Postgbertoli3, on 10 Oct, 2008 - 02:41 PM, said:

Try This
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.
Was This Post Helpful? 0
  • +
  • -

#8 gbertoli3  Icon User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 40
  • View blog
  • Posts: 1,162
  • Joined: 23-June 08

Re: Only Entering in one text box

Posted 10 October 2008 - 04:09 PM

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.
Was This Post Helpful? 0
  • +
  • -

#9 Qball522  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 86
  • Joined: 06-October 08

Re: Only Entering in one text box

Posted 10 October 2008 - 05:30 PM

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.
Was This Post Helpful? 0
  • +
  • -

#10 gbertoli3  Icon User is offline

  • DIC at Heart + Code
  • member icon

Reputation: 40
  • View blog
  • Posts: 1,162
  • Joined: 23-June 08

Re: Only Entering in one text box

Posted 10 October 2008 - 10:36 PM

Here maybe this will help you.
http://www.dreaminco...wtopic32951.htm
Was This Post Helpful? 0
  • +
  • -

#11 technoatticus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-October 08

Re: Only Entering in one text box

Posted 11 October 2008 - 09:40 AM

thanks everyone for the help, the guide should have enough information in it to find a way around (:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1