Solved

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

Posted on 2013-07-01
10
306 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

914 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