Visual Basic Focus() - vb.net

I have a unit converter written in Visual Basic using Visual Studio 2012. It uses two text boxes and two combo boxes. It is programmed to send the focus back to the first text box after making a selection in either combo boxes, but after triggering a textChanged event in the second text box, and then making another selection in either of the combo boxes, the Focus() seems to be selecting all the text data in the first text box. I want only the blinking cursor to be in the box. When all the text is selected like that, it deletes the box when you try to type another digit in there because all of the text is selected. Please give me a solution or a suggestion. If you need some code to look at, just let me know and I will put together a somewhat small block of it to get my point across. Thanks in advance!
By the way, I am using Focus() to send the focus where I need it to go in this program.

Sounds like you want the cursor to be at the end of the TextBox?
TextBox1.Focus()
TextBox1.SelectionStart = TextBox1.TextLength

Related

How to clear a Text Box when changing something in a Combo box?

I'm quite new to coding and I wanted to know how do I get the Text box to clear what's in it when I choose another option in a Combo box, I'm using Visual Basic.
I tried searching for answers myself but came up with nothing, and tried searching for something to help myself but considering I'm new I don't really know where to look.
Create a ComboBox and go to its Event properties located at the bottom-right corner after selecting it. Then you should have found something SelectedIndexChanged, just simply double-click on it and write the following:
myTextBox.Text = "" ' replace myTextBox with your required TextBox
Alternatively:
myTextBox.Clear()
That's it.

Selecting Text Field in VB.NET by MouseDrag

I have a text field and I cannot drag my mouse and select the value/text within the text field in a vb.net application The cursor is stuck in the front of the text. However, just to check, I created another 'test' application containing a text field, and the mouse function is working fine. Mouse can be easily dragged to select the text field. I am completely lost here and any help in this subject matter would be really appreciated. I am wondering whether the fault lies with the application in itself.
Note: I have simply dragged and dropped a text-box from the toolbox of
visual studio and obtained those results. No special code written
Thanks in advance
You may need to check and set the TextBox's Enabled property to True

Clearing number in a Label on Text Box Change

Just have a simple question. I have a program and in it I have a label that displays results once you calculate them, and I want the label to clear once you change the text in the input boxes. Assuming the label is named like lblResult or something, how would I go about doing this?
If you are using Windows Forms, you would handle the TextChanged event of your input box. In the event handler, you would then set your lblResult.Text = ""
If you are using WPF / XAML, the concept it the same, you'd just handle the event a little differently.
You can learn more about VB.NET and Event Handlers on MSDN.

How can I select (or copy) text from a Word 2010 ActiveX label?

A Word 2010 document has an ActiveX label that displays some text. Is there any way to make the text selectable, or otherwise copy-able, from a user's point of view, so he can paste it somewhere else?
Use case: I give the form to someone, they fill it out and return it to me. The element in question is a Label which, when double clicked, produces UserForm1 which has a ListBox on it. Once one or more selections are made and the user presses OK on UserForm1, the Label in the Word doc gets updated. I then receive the form back, and want to right click the label, copy the text, and paste it into an email.
You can't, at least from an end-user's point of view. Let me explain.
I started out wanting to achieve this with a Label, but soon found I couldn't copy the text that was displayed there using conventional ctrl-c or right-click > copy.
So, I switched it up to a TextBox. This worked somewhat, and the data was displayed, though with one flaw: Word 2010 seems to put a bunch of unselectable space between the last line in the TextBox and the bottom of the TextBox, making most the contents hidden until you scrolled back up to the top of it.
Here's what it looked like:
Notice all the empty, unselectable space below the last item in the list?
The solution to my problem of 100% of the text not being displayed in the box was to use this line of code, which places the cursor at the top of the text after the values are placed in the TextBox:
ThisDocument.functionalComponentsTextBox.SelStart = 0
This basically simulates the user manually clicking in the TextBox and pressing the Up key until he reaches the top of the TextBox. With that, the selections from the ListBox are now stored in the TextBox, the contents of which can be copied and pasted wherever as part of our business processes.
Here's what it looks like after: a perfect match when compared to the properly-displayed Label approach! Added bonus: the text is selectable, and the TextBox is customizable so I removed the border from it... can't tell the difference!

Visual Basic 2008: Textbox or label for displaying an answer?

What is the advantage of using a text box to display an answer in Visual Basic versus a label?
Using a (non-Disabled) textbox allows the user to select and copy the text.
You can automatically trigger a new event as soon as the textbox's text is changed using the textChanged function. this is not possible in case of a label.