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.
Related
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
I'm using vb.net 2013.
Is there any way to access and modify the TextBox's context menu items ?
I want to hide some of these items.
And I want to translate the caption.
Thank you !
Yes there is. Example below, where you hide based on a condition that you have set.
if (yourCondition) then
yourTextBox.ContextMenuStrip.Items.RemoveByKey(theNameOfTheStrip)
end if
I'm not sure what you mean by the caption (but i think it is the text)
yourTextBox.ContextMenuStrip.Items.Item(theIndexOrKeyHere).Text
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.
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
Is it possible to have 2 areas of text in one cell such that each can have a different color? You can do this in crystal reports but I cannot see a way to do this in ReportViewer. What it is doing is essentially highlighting an important text fragment if it appears in a cell description to draw the users attention. I am fairly new to reportviewer so it for now I am assuming it's my lack of knowledge that is making this difficult. I am using VS2010.
Thanks.
Turns out VicarlnATutu wasn't quite right.
You can do this, but only if you are using VS2010 (which I am) because it includes the new SSRS rendering engine for SQL-Server 2008. This allows you to put some basic HTML into a field and have multiple formats in one cell. For more info see below:
http://msdn.microsoft.com/en-us/library/cc645967.aspx
http://msdn.microsoft.com/en-us/library/cc627491.aspx
One thing that tripped me up is what they call a 'placeholder' in the MS documentation is the little bit of text inside the textbox control that shows up by default. You can select two different things on the control in VS2010. One is the textbox itself. Right clicking on the textbox gives you 'text box properties'. The other thing you can select is the default text INSIDE the textbox. Right clicking on this 'placeholder' text gives you a different context menu where you can select 'placeholder properties'. This is where you can change the cell to accept HTML.
No, unfortunately not. I don't know if there are custom controls out there for ReportViewer, but the built-in TextBox only supports setting color (be it Foreground or Background) for the entire thing.
ah, good to know. kind of a unintuitive way to tell a TextBox to display HTML, but nice to know that you can!