.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Highlighted text in InputBox

4 REPLIES 4
Reply
Message 1 of 5
hericson
674 Views, 4 Replies

Highlighted text in InputBox

In my VBA application that I'm trying to convert to VB.NET the default value in the InputBox is highlighted but in the VB.NET version the text is not highlighted and the cursor is at the start of the value. Should it be like this or is there a way to change it? Or is my only option to make a dialog that looks like the InputBox?
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: hericson

Is this when your dialog first appears?

If so, how is the dialog shown?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6281801@discussion.autodesk.com...
In my VBA application that I'm trying to convert to VB.NET the default value
in the InputBox is highlighted but in the VB.NET version the text is not
highlighted and the cursor is at the start of the value. Should it be like
this or is there a way to change it? Or is my only option to make a dialog
that looks like the InputBox?
Message 3 of 5
hericson
in reply to: hericson

Yes it is when the dialog first appears. I want the text to be selected so the user just have to type a new value instead of first selecting or erasing it (i'm changing attribute values in block).

The code is like this:

Dim returnVal As String = InputBox("Enter new value:", "Edit block attribute", attRef.TextString)
Message 4 of 5
Anonymous
in reply to: hericson

I haven't worked with VB.NET's InputBox (which from what I can
tell, is mainly to support legacy VB applications), so I can't guess
what may be going on there.

My suggestion is to make your own dialog to get the input, and
just use that instead.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6281895@discussion.autodesk.com...
Yes it is when the dialog first appears. I want the text to be selected so
the user just have to type a new value instead of first selecting or erasing
it (i'm changing attribute values in block).

The code is like this:

Dim returnVal As String = InputBox("Enter new value:", "Edit block
attribute", attRef.TextString)
Message 5 of 5
chiefbraincloud
in reply to: hericson

I first thought there was an option on the selection in an input box, but I am apparently thinking of the options on the standard TextBox control on user forms. (Oddly enough, I seem to think that when I run a certain program I have that recieves a boatload of inputs, the default behavior of InputBox is opposite of yours, so maybe there is some deeply buried windows setting that I have different?)

So you could either create your own simple input form as has been suggested, and set the SelectedText property of the TextBox equal to the Text property, or you could possibly just change up the logic a bit. and do something like this:

Dim returnVal As String = InputBox("Enter new value: [" & attRef.TextString & "]" , "Edit block attribute", "")

As you can see, that would show the user the original value as part of the prompt, and the box would be empty. Then you could insert logic in the code to interpret an empty response as a No Change response, keeping the original value.

Of course that would cause an issue if the user tried to clear the previous value by leaving the box empty.
Dave O.                                                                  Sig-Logos32.png

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost