Solved

VB6 - Put some text in List one in BOLD and copy to clipbord

Posted on 2013-07-01
10
308 Views
Last Modified: 2013-07-01
Hi All

I have this code that feeds my List box and then copy to clipboard.

The thing is that i would like to put in bold everything that is between "".

Ex:
Between "", we have in the code below:  
"Vendor Division: "
"Vendor name: " 

So in the List1, i would see them as:
Vendor Division:
Vendor name:  


And after, when i copy to clipboard, i would still copy the format. What's in BOLD, it would copy in BOLD and what is not in BOLD would not be copied in BOLD.

How can i do that?

Thanks again for your help


Private Sub Command2_Click()
    List1.Clear
    List1.AddItem file_supply_chain
    List1.AddItem "Vendor Division: " & vendor_div.Text
    List1.AddItem "Vendor name: " & vendor_name.Text

    Dim buf As String

    Dim i As Long

    For i = 0 To List1.ListCount - 1

        buf = buf + List1.List(i)

        buf = buf + vbCrLf

    Next

    Clipboard.Clear
    Clipboard.SetText buf

End Sub

Open in new window

0
Comment
Question by:Wilder1626
  • 5
  • 4
10 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39290403
There can only be one font setting for all text in a Listbox, so that wouldn't be possible.
0
 
LVL 13

Assisted Solution

by:Jesus Rodriguez
Jesus Rodriguez earned 20 total points
ID: 39290407
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 39290583
Thanks,

Question knowing that it wouldn't be possible, is there an alternate solution so that what i need would be feasible?

k-designers, your solution is for C+, not VB6
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 76

Accepted Solution

by:
GrahamSkan earned 480 total points
ID: 39290782
This looks like a possible solution:
http://www.vbaccelerator.com/home/VB/Code/Controls/Combo_and_List_Boxes/Owner_Draw_Combo_and_List_Box/VB6_Owner_Draw_Combo_List_Control.asp
There is an .OCX, a ,Dll and a demonstration project. They are all downloadable.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 39290843
Hi GrahamSkan

I'm having the run time error 429
ActiveX component can't create object.

I have put the ocx into the system32 but still not working.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39290859
Have you registered the dll and the ocx?
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 39290870
Both dll and ocx are in the System32 folder but still the same run time error
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 39291123
from what i see , there is not dll. so i have removed the second file i have put in the system32 and i only left the ocx. file

But where is the dll file in question?
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 39291216
HI
Now working. Thanks

I will use that as an way to do it.

Thanks
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39291248
Thanks and well done in overcoming your initial difficulty in getting it to run.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question