Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Highlighted Text Disappears


Hi,
I am coding a MUD client. The client has the incoming text stored in an RTF Text Box. Whenever text is highlighted, no cut or any command done, it disappears when you press enter. It also has this problem when you hit a button.

Thanks!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
DrawString Text Disappears
I am using very simple DrawString code. The text displays, but after resizing the form, it goes away. Is there some additioinal call I need?

The code is something like:

Dim gr As Graphics = Me.ipInkPicture.CreateGraphics
gr.DrawString("This is a test", Font, Brushes.Black, x, y)
gr.Flush(Drawing2D.FlushIntention.Sync)

Combo Box Text Disappears!
I have a combo box that's supposed to show all values in a given database. The procedure works fine until it gets to the end, then for some reason the combo box loses its text. The list items are there, it just no longer shows the item I selected. I ran a quick debug, and it happens right on the first Exit Sub (the one before the error handler.)


Code:
Private Sub MasterControl_Click()
Set fso = New FileSystemObject
On Error GoTo ErrorHandler
MasterControl.Text = Replace(MasterControl.Text, " ", "")
If fso.FileExists(App.Path & "Databases" & MasterControl.Text & ".mdb") = False Then
For i = 0 To MasterControl.ListCount
If MasterControl.Text = MasterControl.List(i) Then
MasterControl.RemoveItem i
End If
Next i
Set rs = New ADODB.Recordset
RecordSource = "SELECT * FROM Headers ORDER BY Name"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "DatabasesHeaders.mdb"
rs.Open RecordSource, ConnectionString, adOpenKeyset, adLockOptimistic
If Not rs.BOF Then
rs.MoveFirst
End If
For i = 1 To rs.RecordCount
If rs!Name = MasterControl.Text Then
rs.Delete adAffectCurrent
Else
rs.MoveNext
End If
If rs.EOF = True Then Exit For
Next i
End If
OrganizerDatabase.ListItems.Clear
Set rs = New Recordset
Set Win32Script = CreateObject("WScript.Shell")
For i = 0 To Data.Count - 1
Data(i).Locked = False
Data(i).BackColor = vbWhite
Next i
RecordSource = "SELECT * FROM " & MasterControl.Text & " ORDER BY SiteName"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "Databases" & MasterControl.Text & ".mdb"
Win32Script.RegWrite "HKEY_CURRENT_USERSoftware" & App.Title & "CurrentSelectedItem", MasterControl.Text
rs.Open RecordSource, ConnectionString, adOpenKeyset, adLockOptimistic
If rs.BOF = False Then
rs.MoveFirst
End If
For i = 1 To rs.RecordCount
If rs.EOF = True Then Exit For
OrganizerDatabase.ListItems.Add , , rs!SiteName
rs.MoveNext
Next i
Set fso = Nothing
Set rs = Nothing
Set Win32Script = Nothing
Exit Sub
ErrorHandler:
MsgBox "Error #" & Err.Number & ": " & Err.Description, vbCritical, "Program Error"
Exit Sub
End Sub

Combo Text Disappears
Hi All,

Here's a strange one. I have 2 combo boxes of the same type on screen. I also have 2 grids and the grids are bound to different ADO recordsets. When I select an item from one of the combos the recordpointer on the associated grid moves to the item where a column has the associated value and all is fine. I do exactly the same with the other combo and grid, but after the recordpointer has moved on the grid, the value in the combo disappears. When stepping the code at the 'End Sub' line of the combo's click event the correct values are still in the combos text property. As soon as I F8/F5 off, the text disappears. I've removed and replaced the control, put debug statements into every event incase somthing else is triggering and nothing is.

HELP! Sending Text To A Web Form Excluding Highlighted Text?
Hello,

I am new here! & also newish to programming, but I am a fast learner.

I'm trying to find out the best method for using vb6 to make an application that can speed up my job at work.

What im trying to do is :

When I highlight some text in an editable text box on a webpage form (PHP),
I want to have the option to auto add <b> to the start of the highlighted text and </b> at the end. maybe having a command button called "Bold"

And also add functions such as automatic line breaks, <BR> at the end of every line? Basically much the same as this box im writing the post in but less features.

How would i go about achieving this? whats the best approach?, and are they any tutorials out there?

Cheers I would appreciate any help on this or any hints!



Cheers!

Text Disappears In Chart In VB Report
Helllo, I have a excel file with a chart that I'm trying to imbed into my VB report. (the sheet is actually updated by a macro in the VB)

Everything looks fine in design mode, but when I preview or print the text (legend and values) dissapear. Is this a size issue or Is there another way to get the chart on my report. Thanks!

Text Disappears When Focus Is Lost?
txtMyRef.Text Properties:
Data Field = MyRef
DataSource = adcInvoiceDisplay

adcInvoiceDisplay Properties:
Command Type = 8 - adCmdUnknown
RecordSource = "SELECT * FROM Invoice"

If the RecordSource has a specific index, then the text field is ok, however on start up, if the database is empty, i type something in the text field, change the focus to another field, and the text vanishes, as though the ADODC is still trying to load data that doesn't exist yet?

Any ideas?

Get Highlighted Text
I've searched this forum and I've found very good material and very good articles, but i didn't find anything related to "get highlighted text from another window". I've seen that you must use API functions, but can you answer me this question: can i get highlighted text from a textbox, rtf textbox or label? If yes can you please point me to the right direction?

Thanks in advance

Getting Highlighted Text
I would like to be able to get the highlighted text from a listbox... is this possible?

The way i was thinking would be highlight set up a hotkey and they hotkey would show a msgbox with the highlighted words. O.o

like "Hi my name is bob"
bob is highlighted press f1
msgbox "bob"

Text Highlighted
hello, how to copy a string highlighted from the text1 and the highlighted string copy to text2?

thanks..

Highlighted Text
Hi there

I want to assign the text that a user highlights in a test box to a variable.

Is there a simple way to achieve this

Thanks

JFK

Highlighted Text
when 'tabbing' through a series of textboxes, is it possible to make the text highlighted by default????

Get Highlighted Text.
How can i get marked text??

text that you have marked with the mouse in a textbox on at webpage or a marked text anyware??

is this a dream i have or can it be done?

Get Highlighted Text From Any App
does anyone know a way i can get the text that is highlighted in any app to my app to moment it becomes highlighted

When Moving Item Down In The Listbox The Text Disappears
Okay dont know why but the text is dissapearing when an item is moved down the list box.

Image1 displays before the move down
Image2 displays after the move down
Code is also attached. I am very confused I have been through this code througherly and I am sure there is not an error in the code.




Code:
' check: only proceed if there is a selected item
' check: last item can't be moved down
' save items text and items indexvalue
' remove item
' place item back on new position
' if you keep that item selected
' you can keep moving it by pressing cmdDown
' for arLoopCount adds the new playlist entrys from
' lstPlayList.
' list1 refreshes
' lstPlayList refreshes
Dim tempStr As String
Dim iIndex As Integer
Dim arLoopCount As Integer
List1.Clear ' Debugging orriented object to display the contents of arFilePlayList Array
If lstPlayList.SelCount = 1 Then
If lstPlayList.ListCount - 1 = lstPlayList.ListIndex Then
Exit Sub
Else
tempStr = lstPlayList.List(List1.ListIndex)
iIndex = lstPlayList.ListIndex
lstPlayList.RemoveItem lstPlayList.ListIndex
lstPlayList.AddItem tempStr, iIndex + 1
lstPlayList.Selected(iIndex + 1) = True
End If
End If
For arLoopCount = 0 To lstPlayList.ListCount
arFilePlayList(arLoopCount) = lstPlayList.List(arLoopCount)
List1.AddItem arFilePlayList(arLoopCount)
Next arLoopCount
List1.Refresh
lstPlayList.Refresh

Subscripting Highlighted Text
Hi. I have a RichTextbox Control that the user can format text. I want to ADD Bottons to Subscript and Superscript the highlighted text. Is this possible?If indeed....how do i do this? I didn't find anything in MSDN

Change Highlighted Text???
I've a question, I've a textbox and I've some code to highlight a part of the text in it, I want to change the highlighted text into something else??? ADn how can I copy it inot another textbox???(this all with only code, thus you only need to press a button and the other stuff happens automatic)

Text Automatically Highlighted
just a simple question but one i cant work out:

when you tab from textbox to textbox, how do you make it so that any text which is stored in the textbox by default is automatically highlighted?

Copying Highlighted Text Only
Copying/Deleting/Cutting coding would all the be same with a few minor extra code add-ins, easy. Now, how would you go about copying only the highlighted portions of text?

Clipboard.SetText type1.Text

will take the text you have in "type1.Text" and put it onto the clipboard. But what if you only want the part you highlighted. I know it must be something along the lines of


Code:
Private Sub mnuCopy_Click() 'identifys what is being clicked "mnuCopy"

Clipboard.SetText type1.Text 'set clipboard to what type1.text has
?? ' highlighting coding

End Sub ' end it!

Thx

Getting Highlighted Text From Another Program
I am creating a program for our company PC's that enables a hotkey. I want this hotkey to perform a particular function based on what is highlighted in whatever application the employee is currently using.

I have created the hotkey easily enough.
I can send CTRL+C to apps and follow it with Clipboard.GetText to determine the highlighted text in MOST applications. But - we have one Windows application that does not support the CTRL+C function as that function is used for another shortcut in that application.

Is there a way to get the highlighted text of any active window?
I thought there might be with the GetWindowText API, but so far I am not looking in the right places.

Any help would be appreciated. Thanks.

Highlighted Text Into Variable
I'm trying to move only the highlighted text from a text box into a recordset. The user is presented a list of item numbers, which they can then select and send to a recordset for printing. How can I determine what text is highlighted?

ie:
123456-000
234567-000
345678-000 <---- user double clicks this and highlights this line

How can I read that line into a variable?

Thanks

Adjusting Highlighted Text
I started a text editor for toolbar practice, but i cant figure out how to adjust only highlighted text. example:copying only a few words

Highlighted Text In Inputbox?
how would I make an inputbox display with highlighted text
(i.e. as selected with mouse, so user needn't select the text before typing input?

Stop Text Being Highlighted
I have an array of text boxes which are locked, but enabled.

How can I stop the text being highlighted when the user drags the mouse over the contents of the TextBox.

I don't want to make them Enabled = False as I want the text to be the usual colour.



Edited by - andy99 on 12/6/2003 7:36:44 AM

Highlighted Text Of A Gif File
i want to show a highlighted bar on a gif, when i speeck or computer speek "Hello how r u. Where r u from." basically its written in a gif file, i want to highlight first sentence and then after some some 2nd sentence. what i do for this, Thanx

I want to enhance my knowledge.

Picturebox Text Disappears When Backcolor Changed (RESOLVED)
Changing the backcolor as below causes the text in it not to appear.
Any ideas?

Code:Picture2.Cls
Picture2.Print Format(tr1, "fixed"); Chr(10);
If tr1 >= 1.5 Then Picture2.BackColor = vbGreen Else Picture2.BackColor = vbWhite

Also,While I'm here, , how can I choose a fixed no. of decimal places? In the code above it is set to 2.

Thanks for any help

Jim



Edited by - jimvt on 6/18/2004 4:54:02 AM

Unselecting Highlighted Text In Word
Hello All,

I made a small piece of code that prints some lines of text onto a blank word document. Afterwards, I simply want to copy all the text from the document to the clipboard. Here's the code I'm using right now:


Code:
Selection.WholeStory
Selection.Copy
Now, this works just fine but I don't want the copied text to stay highlighted after the copy operation is performed. How do I unselect all the text in code?

Thanks,
Jason O

Highlighted Text In Internet Explorer
hi ...
i hope anyone can help me with this problem ...
iam trying to make a small app. that will get only the highlighted text in internet explorer ... is this possible !?

i will add a timer that will check for the forground window, and then get the highlighted text ...
the app will only be used to get highlighted text from internet explorer ...

can anyone please help !?

ahh, i won`t be using the "Microsoft internet controls" ...the internet explorer window will be opened seperatley ..

thanks guys for your help ..

Required Text Boxes Highlighted!
What's the best way to color in a text box that needs to be highlighted as required. I would think that making my text box's background to red and foreground letters white would make an impression....what is the code commands to make the text box work this way? Thanks you guys...I'm programming long and hard into the night!

Stephen

Store Highlighted Text In A Variable
I have a multi-line textbox where I want to highlight a range of text using the mouse and then click a command button to store that text in a variable.

Is this possible?

Thanks,

Jon

Copy Text That's Been Highlighted In Acrobat
Hello people,

I'm new here and new to the world of Visual Basic, so I need some help. I'm trying to make an application that will do an automatic job on renaming PDF files according to their internal Title or a manual input given by the user with the aid of a simultaneous view of a certain PDF within the same form.

There have been problems but I've found some quick solutions. Now I have a form with an ActiveX control for Acrobat (acropdf) where there is a PDF file loaded and shown within the form. I can highlight a portion of the text from the PDF file, then by pressing a button on the form I want this text to be copied to clipboard (without having to copy it manually with Ctlr+C or otherwise from the pdf) and then pasted inside a textbox of this form. So I want to trigger a copy function to Acrobat externally, but I can't find which method to use.

Maybe I should not use this ActiveX control but something else? or is there a way for this to work as it is right now? can you help me?

thank you in advance

Search For Highlighted Text And Replace??
Hi guys, I'm trying to write a program that the user would highlight some text in a text box and then would press a button to put a header before and after it. Something like html stuff.
Here's an example. highlight text "hello" and puts "<H>hello</H>"

I've put some code in that I've been working on but when I replace it with the above, it only does the first "hello" that it finds and not the one that i've selected.

Some help would be appreciated.

Ta

Private Sub cmdAlbum_Click()

'<N> </N> for Name of album
Text1.SetFocus ' Set the focus for

hlt = Text1.SelText

txtSelected.Text = hlt
strAlbum = "<N>" & hlt & "</N>"

txtSelected.Text = Replace(txtSelected.Text, hlt, strAlbum, , 1)
Text1.Text = Replace(Text1.Text, hlt, strAlbum, , 1)
End Sub

Code For Blink Any Highlighted Text In Vb
=A0

=A0

Hi,



I have a problem.In dhtml edit control, when we elect(highlight) any portion of text then we click any command button,theni want the highlighted text should blink without using Timer control.Pleas send me coding of my problem as soon as possible.Thanks.



Atul Chaturedi

Can You Extract Highlighted Text Using An API Call
I need to determine what text has been selected in a document, either by clicking and dragging the mouse or by using the keyboard. Is there an API that returns this information? If so, can I retrieve line numbers or character counts as well?

Thanks for any help and/or suggestions.

Have a great day!

j2consulting@yahoo.com

Highlighted Text In Listbox- RESOLVED
This problem is not affecting the operation of my application, but it will be distracting to the end user, so I'd like to fix it.

I have a listbox, with style set to 1- Checkbox. This, or course means that it allows Multi-Selection.

The presence of the checkmark on each line is supposed to indicate that item has been selected, which is working fine.

The problem is that the text is being highlighted apparently randomly. Text is being highlighted even if the item hasn't been checked. I'm concerned that this will confuse users who might think the highlight means that item has been selected when it actually hasn't.

I know this must be something simple. (In the end, aren't 99.9% of all problem solutions?)

Can anyone please help?

Thanks

 

Edited by - SchMan on 7/14/2003 5:50:36 PM

Save Highlighted Text From Browser To File
Hello Group,

Bit of a newbie so please stay with me on this.

I want to save some ISBN numbers from a web site to a flat text file located in the application directory.

So, I go to the web page and highlight the text. What I would like to do is hit an “F Key” and have the highlighted text saved to file.

Could someone please point my in the right direction.

Thanks in advance.

Regards
Jeff

Copy And Paste Highlighted Text From Other Window
Hi there,

Is it possible to have my app monitor, say IE, for any text the user highlights.. and copy that text to a textbox? This would be an instant copy and paste.. without the keystrokes or clicking.. simple highlight (mousedown/mouse release defining the string to copy)

I would start by hooking that window.. but then I'm at abit of a loss.

Thanks in Advance!

Getting The Start Position And Length Of Highlighted Text ?
I know how to highlight text by giving a start position and length, but how do I do it the other way ? As in, I highlight the text using the mouse, and then the program calculates the position of the highlighted text ?

How To Pass Highlighted Text In A Textbox To A Variable?
I was wondering if anyone can help me. I am trying to Highlight text in a textbox (not all text will be highlighted) and assign it to a variable so I can parse it. If anyone knows how to do this, please enlighten me

** RESOLVED ** Can You Detect Highlighted Text In A Textbox ?
Is it possible to determine if text in a textbox is highlighted ?

Determine The Start And The End Points Of Highlighted Text In Richtxt
How do I insert the vb code such as [color.=red] xxxxx [/color.] at the start and end of a highlighted text in RichTextBox.

Retrieve Highlighted Text From Word Doc Loaded Into WebControl
Hopefully someone can help me. I have loaded a Word Doc into the WebBrowser control. Once the WebBrowser control has the Word Doc loaded (no issues here) I highlight text. Programmatically, I want to do something with that highlighted text but I can not find a way to retrieve it. If I simply load an HTML page - no problem, I can get to the highlighted text a number of ways but NO luck if the file I am accessing is a Word Doc.

So I load the control as follows:

WebBrowser1.Navigate "C:Temp est.doc" ' or something like that...

I have tried:
- Using SendKeys
- Using Keyboard events...
keybd_event VK_CONTROL, 0, 0, 0 ' etc....
- The ExecWB commands...
WebBrowser1.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER
- SendMessage hWnd, WM_COPY, 0, ByVal 0&


Everything I list above works to copy text to the clipboard if I only load an HTML page but NOT if I load a Word Doc or Excel Doc into the WebControl. If anyone can help me I would be grateful.

THANKS!

Keeping Text Highlighted While Switching Focus To Another Form
How do I mimic the find feature from NotePad? My problem is that I can find the words and highlight them, but when I switch focus back to the find form to allow the find next button, I lose the highlighted text from the main form.

Somehow, NotePad and WordPad are able to switch from the find form to the main, highlight the text, and then return to the find form without losing the highlighted text.

Anyone know how it's done?

Highlighted Or Blinking Text-user Form-excel
Hello

If it is possible, using a form in excel how can I highlight text on a Textbox o make it blinks before user type in information?

Thanks a lot

Copy Highlighted Text From Word Doc Loaded Into WebBrowser Control
OK folks, I have pulled out last of my hair. Basically, I am loading a Word Doc into the WebBrowser control. Once the WebBrowser control has the Word Doc loaded (no issues here) I try to highlight text. Programmatically, I want to do something with that highlighted text but I can not find a way to retrieve it. If I simply load an HTML page - no problem, I can get to the highlighted text a number of ways but NO luck if the file I am accessing is a Word Doc.

So I load the control as follows:

WebBrowser1.Navigate "C:Temp est.doc" ' or something like that...

I have tried this:

VB Code:
Private Sub cmdSendCopy_Click()    Clipboard.Clear        ' Send a copy command of highlighted text    WebBrowser1.SetFocus    SendKeys "^{c}", True        ' Get the text from the clipboard.    Text1.Text = Clipboard.GetTextEnd Sub

I have tried this:

VB Code:
' Grab the text highlighted in Internet Explorer.Private Sub GoGetIt()    ' Clear the clipboard.    Clipboard.Clear     ' Set focus to the WebBrowser control.    On Error GoTo Crazyerror    WebBrowser1.SetFocus     ' Press Control.    keybd_event VK_CONTROL, 0, 0, 0    DoEvents  WebBrowser1.SetFocus    ' Press C.    keybd_event VK_C, 1, 0, 0    DoEvents     WebBrowser1.SetFocus    ' Release Control.    keybd_event VK_C, 0, KEYEVENTF_KEYUP, 0    DoEvents        WebBrowser1.SetFocus    ' Release Control.    keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0    DoEvents     ' Get the text from the clipboard.    Text1.Text = Clipboard.GetText    Exit SubCrazyerror:Debug.Print ErrDebug.Print Err.Description End Sub
And this...

VB Code:
Private Sub cmdAndThis_Click()Clipboard.Clear WebBrowser1.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER      DoEvents     ' Get the text from the clipboard.    Text1.Text = Clipboard.GetText  End Sub
Here is another:

VB Code:
Private Sub cmdAndMore_Click() SendMessage hWnd, WM_COPY, 0, ByVal 0& End Sub

Does anyone have a solution out there? I am truly stumped and I have spent days searching for a result. As I mentioned, the methods I describe above all work for an HTML page loaded into the WebBrowser control but NO luck if I load a DOC or XLS etc.

Please help!!!!

*** Resolved ***Save Highlighted RTF Text Using COmmon Dialog SaveAs
A while back someone raised the question as to how to save the highlighted text to a file and several wrote and gave examples as to how this can be accomplished. However, as I remember (I can't seem to find the original post), they all used a coded file name and path.

Can anyone show me how to save the highlighted text from a RTF box to a file through the Common Dialog SaveAs so that I can give the highlighted text a filename and path?

It would be most appraciated.

Rev. Michael L. Burns

Text Box Text Disappears
I am using the following code.
Code:
Private Sub txtData_KeyPress(Index As Integer, KeyAscii As Integer)
Dim strText As String
Dim rsText As ADODB.Recordset
Dim i As Integer

If KeyAscii = 13 Then
strText = "select * from TableName where Field_Name='"
strText = strText & txtData(0).Text
strText = strText & "'"

Set rsText = New ADODB.Recordset
rsText.Open strText, strConnStr, adOpenStatic, adLockPessimistic

For i = 0 To rsText.Fields.Count - 1
If IsNull(rsText.Fields(i).Value) Then
txtData(i).Text = ""
Else
txtData(i).Text = rsText.Fields(i).Value
End If
Next
End If
End Sub
User enters value from the field in txtData(0) and will press 'Enter' key. When observed during debugging, all the text boxes will have appropriate value. But, when the control comes out of End Sub, txtData(0) becomes blank. Does any one know why it happens?

Changing Color Of The The Highlight Color And Highlighted Text Color
does someone know of a snippet where it shows how to change the color of the hightlight bar/color and the highlighted text,i am doing something in a rtb and i hate when colors are bouncing all over when highlighting it and wanna set two main colors for highlighting but cant seem to find a snippet

Tab Contents Disappears
Would certainly appreciate some help with this!!

I have a form with 6 tabs on it using microsofts SSTab component. Now the problem...when I place another form on top of it, then hide that form, the contents of the tab disappear. You have to click on another tab, then back to get the information to reappear. I have tried refreshing with doevents, but it doesn't work. If I refresh in the immediate window, it refreshes and is visible, but when running the program, it doesn't.

Any ideas?

Thanks...TeeTime3

VBA Code Disappears Help!
After I create VBA Code in Excel 2007, it disappears. I create it, close VBA, return to Excel. However, when I try to go back to view the code, I get a blank VBA window. Any ideas?

Copyright © 2005-08 www.BigResource.com, All rights reserved