473,804 Members | 3,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting selected text values

I am having a problem. How can I get the selected text from a text editor.
I am using ASP.NET and VB as language.

Thanx
Nov 19 '05 #1
5 1971
Hi Hassan
yourcontrol.sel ecteteditem.tex t
hope this help:)

"Hassan Bassam" wrote:
I am having a problem. How can I get the selected text from a text editor.
I am using ASP.NET and VB as language.

Thanx

Nov 19 '05 #2
It's a client side function. Look at DHTML document.select ion object. You
can get the selected text on the client and communicate it to the server in
a hidden text input.

Eliyahu

"Hassan Bassam" <Hassan Ba****@discussi ons.microsoft.c om> wrote in message
news:3F******** *************** ***********@mic rosoft.com...
I am having a problem. How can I get the selected text from a text editor.
I am using ASP.NET and VB as language.

Thanx

Nov 19 '05 #3
I've already used the DTE object and have coded the following lines into a
button click event:

' Get an instance of the currently running Visual Studio .NET IDE.
Dim dte As New EnvDTE.DTE
dte =
System.Runtime. InteropServices .Marshal.GetAct iveObject("Visu alStudio.DTE")

'Get selected text
Dim objSel As TextSelection = dte.ActiveDocum ent.Selection

lblTest.Text = objSel.Text

however, i am getting the following error:

Exception Details: System.Runtime. InteropServices .COMException: COM object
with CLSID {3C9CFE1E-389F-4118-9FAD-365385190329} is either not valid or not
registered.

on the following line of code:

Dim dte As New EnvDTE.DTE

I hope that you can help me.

Thanx.

"Eliyahu Goldin" wrote:
It's a client side function. Look at DHTML document.select ion object. You
can get the selected text on the client and communicate it to the server in
a hidden text input.

Eliyahu

"Hassan Bassam" <Hassan Ba****@discussi ons.microsoft.c om> wrote in message
news:3F******** *************** ***********@mic rosoft.com...
I am having a problem. How can I get the selected text from a text editor.
I am using ASP.NET and VB as language.

Thanx


Nov 19 '05 #4
You are talking about Visual Studio text editor. Here we discuss ASP.NET and
I thought you were talking about selected text in an html control. You
should ask in a relevant newsgroup.

Eliyahu

"Hassan Bassam" <Hassan Ba****@discussi ons.microsoft.c om> wrote in message
news:B4******** *************** ***********@mic rosoft.com...
I've already used the DTE object and have coded the following lines into a
button click event:

' Get an instance of the currently running Visual Studio .NET IDE.
Dim dte As New EnvDTE.DTE
dte =
System.Runtime. InteropServices .Marshal.GetAct iveObject("Visu alStudio.DTE")

'Get selected text
Dim objSel As TextSelection = dte.ActiveDocum ent.Selection

lblTest.Text = objSel.Text

however, i am getting the following error:

Exception Details: System.Runtime. InteropServices .COMException: COM object
with CLSID {3C9CFE1E-389F-4118-9FAD-365385190329} is either not valid or not registered.

on the following line of code:

Dim dte As New EnvDTE.DTE

I hope that you can help me.

Thanx.

"Eliyahu Goldin" wrote:
It's a client side function. Look at DHTML document.select ion object. You can get the selected text on the client and communicate it to the server in a hidden text input.

Eliyahu

"Hassan Bassam" <Hassan Ba****@discussi ons.microsoft.c om> wrote in message news:3F******** *************** ***********@mic rosoft.com...
I am having a problem. How can I get the selected text from a text editor. I am using ASP.NET and VB as language.

Thanx


Nov 19 '05 #5
I am sorry, I used the wrong object in my web application. I'll try to use
the DHTML documet.selecti on object and return to you later.

Thanks for your help.

"Hassan Bassam" wrote:
I've already used the DTE object and have coded the following lines into a
button click event:

' Get an instance of the currently running Visual Studio .NET IDE.
Dim dte As New EnvDTE.DTE
dte =
System.Runtime. InteropServices .Marshal.GetAct iveObject("Visu alStudio.DTE")

'Get selected text
Dim objSel As TextSelection = dte.ActiveDocum ent.Selection

lblTest.Text = objSel.Text

however, i am getting the following error:

Exception Details: System.Runtime. InteropServices .COMException: COM object
with CLSID {3C9CFE1E-389F-4118-9FAD-365385190329} is either not valid or not
registered.

on the following line of code:

Dim dte As New EnvDTE.DTE

I hope that you can help me.

Thanx.

"Eliyahu Goldin" wrote:
It's a client side function. Look at DHTML document.select ion object. You
can get the selected text on the client and communicate it to the server in
a hidden text input.

Eliyahu

"Hassan Bassam" <Hassan Ba****@discussi ons.microsoft.c om> wrote in message
news:3F******** *************** ***********@mic rosoft.com...
I am having a problem. How can I get the selected text from a text editor.
I am using ASP.NET and VB as language.

Thanx


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6317
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by the choice from the drop down box. Something like: <form name="populatefrm" id="contactfrm" method="post"
1
5643
by: Mike | last post by:
I create a dynamic control and added it to a panel. I get the selected value of the control via a btn_click() but my problem is everytime the page is postback the selected values go back to the first element in the dropdownlist. but if i call the control creation with if !=postback then the controls disappear. and selected values = null. Any help on this would be great
2
5826
by: Stephen Miller | last post by:
When I dynamically populate a HtmlSelect combo box, the Value property consistently fails to return the item selected, defaulting instead to the first item in the list. For example: Protected WithEvents Fruits As System.Web.UI.HtmlControls.HtmlSelect Protected WithEvents Results As System.Web.UI.WebControls.Label Protected WithEvents Button1 As System.Web.UI.WebControls.Button … Private Sub Page_Load(ByVal sender As System.Object, ByVal...
4
4010
by: juststarter | last post by:
Hello, I have an aspx file where i've put a placeholder element. On load (page_load) i create dynamically an html table which contains a checkbox and a radiobuttonlist in each tablerow . The radiobuttonlist contains two items (yes,no). Both the checkboxes and the radiobuttonlist are NOT autopostbacked ( .autopostback = false). When i press the submit button a sub (submit_pressed) is run. My problem is that i can not get the selected items...
9
3969
by: Good Man | last post by:
Hi This is sort of a weird question, perhaps a bit off-topic... I am on the 'edit' screen of a web form, and I have a bunch of variables coming from a database that need to be placed into the form. In the past, I have been using PHP to pre-populate each field, something like <input type="text" id="firstName" value="<?= $first_name ?>" />
6
22182
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
0
3579
by: rehanmomin | last post by:
Just to start off, I am writing a web application using C#. I have a Menu which is binded to an XML datasource. There are three menu items each with submenus and a textbox where I want to display the value of the selected menu item. Heres the XML datasource that I am using: <?xml version="1.0" encoding="utf-8" ?> <Home> <Menu text="Patient" description=" "> <SubMenu text="First Name" description="firstName"></SubMenu> ...
1
4932
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button. The Category name is being fetched from the oracle db along with the corresponding Category order. In the corresponding input field (text box) the user enters a new category order which gets stored in...
9
2631
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of the main floors of the main house: Part C: Gross Floor Area of the basement or cellar: Part D: Gross Floor Area of the attic:
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.