Solved

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

Posted on 2013-07-01
10
304 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now