Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Textbox Properties from VBScript

Reply
Thread Tools

Textbox Properties from VBScript

 
 
Gary Nelson
Guest
Posts: n/a
 
      10-29-2003
I am trying to get at the properties of a TextBox from VBScript on an
ASP.NET page. In particular I'm trying to find the equivalent of the
Textbox1.SelectedText property. Could anyone tell me what it is?

Is there any place where you can find a list of equivalents between VB.Net
and Script?

So far I've found several like:

LostFocus = OnBlur

Count = Length

and a few others, but every time I run into a new one it is very difficult
to figure out the equilvalent.

Also, when I stop the execution of a script running on a web page, from the
Command window I can get at the properties of a control, but it won't list
them all. I get the following message:

< More... (The first 100 of 165 items were displayed.) >

How can I get the rest of the items to display?

Gary






 
Reply With Quote
 
 
 
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-30-2003
Hi Gary,

Thank you for posting to the MSDN Managed newsgroups. We are acknowledging
your post and you should receive response from the community within 2
business days of your post.

If you have any concerns, please feel free to let us know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
 
 
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      10-30-2003
Hi Gary,

Firstly I want to let you know that vbscript is a subset of the vb
language. That is, many properties or methods from vb language may not be
implemented in vbscript. In other words, there may be not one-to-one
mapping between vb and vbscript. In addition, there is no mapping table
between the two languages.

As for the selectedText, in HTML, we can make use of the document.selection
object, as well as capturing the MOUSEUP event to implement the same
function as what the selectedText property in desktop application.

For your reference, I copied the whole html below. (I am using JScript for
the demonstrating.)

----------------------------
<HTML>
<HEAD>
<TITLE> New Document </TITLE>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var text = "";
function getActiveText(e) {

// Sets text MSIE or Netscape active
// text based on browser, puts text in form
text = (document.all) ? document.selection.createRange().text :
document.getSelection();

document.theform.text.value = text;
return true;
}

document.onmouseup = getActiveText;
if (!document.all) document.captureEvents(Event.MOUSEUP);
// End -->
</script>
</HEAD>

<BODY>
<center>
<form name=theform>
Highlight any text on the page and JavaScript will 'capture'<br>
it in the textbox below. Internet Explorer also allows for <br>
the capture of text highlighted within a textbox or textarea: <br>
Here's two to try out:<br><br>

<input type=text name=demo value="highlight me!"> or <textarea>or highlight
me!</textarea>
<br>
<br>
Selected text: <input type=text name=text value="">
</form>
</center>


</BODY>
</HTML>
---------------------------------------------------

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
Gary Nelson
Guest
Posts: n/a
 
      10-30-2003
Jacob,

Thanks for the help!

I was able to get your code working and it is along the line of what I want
to do, but I have just one problem.

Since I'm doing my script in VBScript I need to be able to do one of two
things:

Convert the lines:

text = (document.all) ? document.selection.createRange().text :
document.getSelection();

to VBScript. Or call the getActiveText function from VBScript and get the
value of the selected text back.

I don't know Java script, so I can't figure out what the ? means on the
line. And I tried calling the getActiveText function, but my VBScript
doesn't seem to see it.

Thanks again,


Gary




"Jacob Yang [MSFT]" <> wrote in message
news:...
> Hi Gary,
>
> Firstly I want to let you know that vbscript is a subset of the vb
> language. That is, many properties or methods from vb language may not be
> implemented in vbscript. In other words, there may be not one-to-one
> mapping between vb and vbscript. In addition, there is no mapping table
> between the two languages.
>
> As for the selectedText, in HTML, we can make use of the

document.selection
> object, as well as capturing the MOUSEUP event to implement the same
> function as what the selectedText property in desktop application.
>
> For your reference, I copied the whole html below. (I am using JScript for
> the demonstrating.)
>
> ----------------------------
> <HTML>
> <HEAD>
> <TITLE> New Document </TITLE>
>
> <SCRIPT LANGUAGE="JavaScript">
>
> <!-- Begin
> var text = "";
> function getActiveText(e) {
>
> // Sets text MSIE or Netscape active
> // text based on browser, puts text in form
> text = (document.all) ? document.selection.createRange().text :
> document.getSelection();
>
> document.theform.text.value = text;
> return true;
> }
>
> document.onmouseup = getActiveText;
> if (!document.all) document.captureEvents(Event.MOUSEUP);
> // End -->
> </script>
> </HEAD>
>
> <BODY>
> <center>
> <form name=theform>
> Highlight any text on the page and JavaScript will 'capture'<br>
> it in the textbox below. Internet Explorer also allows for <br>
> the capture of text highlighted within a textbox or textarea: <br>
> Here's two to try out:<br><br>
>
> <input type=text name=demo value="highlight me!"> or <textarea>or

highlight
> me!</textarea>
> <br>
> <br>
> Selected text: <input type=text name=text value="">
> </form>
> </center>
>
>
> </BODY>
> </HTML>
> ---------------------------------------------------
>
> Does it answer your question? If I have misunderstood your concern, please
> feel free to let me know.
>
> Best regards,
>
> Jacob Yang
> Microsoft Online Partner Support
> Get Secure! ¨C www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>



 
Reply With Quote
 
Gary Nelson
Guest
Posts: n/a
 
      10-30-2003
Jacob,

Thanks for all the help!

The document.selection.createRange().text does what I need. So I've worked
it out.

Gary


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
asp vbscript textbox paste from word problem GTN170777 ASP General 5 10-17-2008 12:44 PM
CompositeControls: ViewState properties w/ Mapped properties probl =?Utf-8?B?Q2hyaXN0b3BoZSBQZWlsbGV0?= ASP .Net 1 01-19-2006 09:19 AM
Making Custom Control Properties Visible in Visual Studio's Properties Palette Nathan Sokalski ASP .Net 0 10-17-2005 02:05 AM
Re: C++ properties Library Created (was Binding together Properties of Objects) Victor Porton C++ 1 08-29-2004 08:02 PM
Problems parsing when Properties.dtd.properties Kent Lichty Java 0 04-16-2004 03:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57