Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox -- deselect ..the highlighted text ???

Status
Not open for further replies.

MaxRaceSoftware

Programmer
Jun 10, 2002
36
0
0
US
i'm using a ListBox as a TextBox in VB6 Application

Problem= when the user just clicks one time in
the ListBox ..that line is "HighLighted" in
DarkBlue .

Question= How can i "De-select" or "unHighLight"
the color so it again appears like
an ordinary TextBox

i'm trying to make a ListBox appear as a TextBox
...any additional comments , as to ADD Copy and Paste
functions to ListBox will be helpful !

i'm using a ListBox to read in large TEXT files because of the limitation of the TextBox to 64K or 32K
and don't want to use a "RichTextBox" Control on this Form

Thanks for help


MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 
Thanks OZ ,

it does remove the "dotted-selection-line"
but the BackColor remains

it doesn't clear the BackColor

and if you scroll way down in reading the Text in the
ListBox ..then click on the Text ..it jumps back to the
TOP ...with no dotted-selection line but still leaves the Blue selection color on the text where you last clicked the ListBox

but i can use what you posted in a LOOP
to find Selected ListIndex's
and maybe clear color that way,..but it "Slows-Down" Application

there must be a better way ?

API ???

thanks OZ , anyway,
and Merry Christmas

MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 
'It is complete example:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long


Const LB_SETSEL = &H185

Private Sub Command1_Click()
Dim i As Long
i = SendMessage(Me.List1.hwnd, ByVal LB_SETSEL, ByVal CLng(0), ByVal CLng(-1))
End Sub

'Just put on the form ListBox and Button
 
TJNweb (Programmer) Dec 25, 2002


Thanks for the Christmas present !!!! :)

it works great ! gets rid of the colored-selection line

but leaves the dotted-selection still in place

.........but i fixed the "dotted-selection-line" with just setting "FOCUS"
to a TextBox or other Control on the Form after clicking inside the ListBox ....now it works great !

Thanks
MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 
one more thing i noticed in MS documentation

ListBox = 32 K number of Items

so is that 32,000 x 255 = 8,160,000 bytes of Text File

limit you could load into a ListBox ?????

what about sizes or limitations in a multi-column ListBox

..just to check this out , i went back and ran same VB6 code in VB 1.0 's ListBox Control..and it works with "user"
lib ...can load and view huge Text files in either VB1.0 or VB6

MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top