Outputting Bold Text Using Windows API
Hi
I am using VB6 and am currently drawing some text onto a picture box using the TextOut() function, how do I change the font, font size and make it bold? I can change the colour using the SetTextColor() function, but haven't been able to find how to achieve the other formatting options.
Thanks in advance,
Mark
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Bold/non-bold Text On CommandButton?
Is there any way to make PART of a CommandButton's Caption bold, and part of it not bold (normal)?
For example, if I wanted the first word to be bold and subsequent words to be NOT bold...how would one do that?
Text Align When Outputting To Text File
I have three variables here: item number, description, and price. Each line can be a maximum of 50 characters. I need the first two variables left aligned and the last one right aligned on the same line when outputting to a text file, so it looks like:
Code:
01234567890123456789012345678901234567890123456789
itemno description, color price
I already wrote functions for right alignment but I cannot figure out how to have two different alignments when outputting to the text file on the same line. Anyone have any ideas? Thanks.
Outputting To A Text File
Lo all, i'm new to this so try to bare with me
I've been creating a DataBased based program for
storing people's details. I won't bore you with the details
but its basically a fancy AddressBook with new fields etc.
Could anyone tell me how to create a button that would save
all (or just the current) database entry to a text file?
Its basically so we can print the details off easier without
using "Me.Print" etc.
If its required I can post the source files in a .zip or .rar.
Outputting Text To Net Term
I'm writing code that needs to export data to a text file, but I'm unable to get it to export quotation marks.
For example, I need the text file to read:
Output "rcv:apptext!"
but the code is exporting:
Output rcv:apptext!
I've tried the print to file and write to file commands and neither seem to work. Thanks for your help!
Outputting To A Text File
Hi Everyone,
The below code is working execept for the fact that it is only displaying the very end of the data. "List1" is the name of my textbox. I have the multiline value set to true. How can I make it display all the data into a text box? Thank you.
VB Code:
If Not (IsEmpty(arrkeynames)) ThenFor Each subkey In arrkeynamesregpath = strkey & "Network" & subkeyregentry = "RemotePath"objreg.getstringvalue HKEY_USERS, regpath, regentry, dapath list1 = subkey & ":" & vbTab & dapath & vbNewLine
Outputting To A Text File.
Hi,
Does anyone have any tips (or know of any good web sites/tutorials) for neatly formatting text in an output file (.txt). I'm finding it difficult to get everything lined up with headers, and because some of the bits of data are of different length, all the bits of data in my tables are out of position.
TYIA
Pile
Outputting Text Lines?
I have a text file which contains lines of data. I only need to output certain lines based on the following criteria:-
Each new record begins with "H", ie header record. Then within each header record i can have muliple lines of "D" records, i.e detail records.
For each record beginning with "H" i
ONLY OUTPUT lines, beginning with D08 or D12 or D93
See example test lines below.
example of text file:-
H 20397337568237 company1
D90
D88
H 203866547658769 company 2
D01
D08
H 237693709283470 company3
D08
D01
There are 3 records in the above example. I do not want to output record 1,compnay 1 as it doesnt have a D08 or D12 or D93 beneath it.
I do want to output record 2,companY 2 because it has a D08 beneath it.
I do want to output record 3 , company 3, because it also has a D08 beneath it. However record 3 will not output for me when i use the code below, because D08 is not at the end of line?? Dont know why this is happening, Can anyone re-jig my if statement.
VB Code:
If useThisRecord Then '' now check through line by line to see if it contains a D93 record '' For j = 0 To UBound(strRecord) If (Left(strRecord(j), 3) = "D12") Or (Left(strRecord(j), 3) = "D08") Or Left(strRecord(j), 3) = "H20" Or (Left(strRecord(j), 3) = "D93" And Mid$(strRecord(j), 62, 1) = "S") Then useThisRecord = True Else useThisRecord = False End If ''if there is in fact a D93 record, then check if there's a P field If Left(strRecord(j), 3) = "D93" Then '' if there is a P at position 62 then this record is not okay '' useThisRecord = Not (Mid$(strRecord(j), 62, 1) = "P") End If Next End If
Outputting To Text Files
2 questions:
1) Does anyone know how to export a string to a text file without putting the quotation marks around it.
2) Anyway of stopping VB from zero suppressing integers eg stopping an input 0052 from being outputted as 52???
How To Make Bold Text In One Textbox Bold In Another Textbox
I am writing a somewhat basic chat application, I was on the verge of releasing it when I spotted a bug. When I typed with bold text inside Text1, it only appeared normal inside Text2. Is there any way to have Text2 display the text formatting as well? I would also like to do this with the text colors.
Outputting To Existing Text File
I am a novice programmer.
How do I output the text appearing on a label so that it outputs to an existing text file exactly as it appears on a label?
This is what I have done so far.
Private Sub PurchaseCmd_Click()
Open "D:Documents and SettingsChris LatinoDesktopProjUnmodifiedProjectpao.dat" For Append As #1
Write #1, receipt.Text
Close #1
End Sub
If Statements - Text File Outputting?
I have a program which reads a text file, line by line, then outputs certains lines to a new text file. Heres an example of a 2 lines in my text file.
H 623556348762 company1
D93
D08
H 623556898798 Company2
D08
D01
D34
Each record begins with a H, therefore in the above example i have 2 records. When the code reads the text file, it outputs those records when D08 comes last in the lines, see record 1 above(company1). BUT when D08 comes in the middle of the record it does not get outputted, see record 2, company2. So if theres a D01 or any other line after a D08 line it ignores my Rule to output.
WHY is this happening to me?!! Ive pasted the IF Statements below which take care of the selection criteria. Basically, i need to output all records which have a D08 line , no matter of its position within the record.
Thanks
xx
Paste the code below into a text file to make it more readable.
'' if this record is still okay
''
If useThisRecord Then
'' now check through line by line to see if it contains a D93 record
''
For j = 0 To UBound(strRecord)
'' if there is in fact a D93 record, then check if there's a P field
''
If Left(strRecord(j), 3) = "D93" Then
'' if there is a P at position 62 then this record is not okay
''
useThisRecord = Not (Mid$(strRecord(j), 62, 1) = "P")
If Left(strRecord(j), 3) = "D12" Or Left(strRecord(j), 3) = "D08" Or Left(strRecord(j), 3) = "D93" And Mid$(strRecord(j), 62, 1) = "S" Then
useThisRecord = True
End If
End If
'End If
Next
End If
Outputting Strings To A Text File
Hiya, what I want to do is output a series of string variables to a simple .txt file. I know how to do this, but the problem is it outputs the "" marks as well. I want to get rid of these as they can't be read by another program that reads the text file. However the program I'm writing must be able to read the values in the file back as strings. Can anyone help?
Thanx in advance,
Matt
Need Assistance In Outputting To A Text File
Hello to all,
I have a text file with customers names and their purchases over a 5 month period.
It would look like similar to whats below:
"Name", "M1", "M2", "M3", "M4", "M5"
"Harry Jones", 250, 300, 450, 100, 250
"Henny Penny", 100, 200, 150, 300, 250
"Tom Mack", 110, 320, 150, 345, 430
"Jenn Street", 320, 280, 450, 320, 840
"Mary Jacobs", 430, 350, 700, 630, 290
Using VB6 and reading this text file, lets call it customers.txt, how can I output each customers name with their calculated total purchases into another textfile lets call it custtot.txt that would look like this:
Customer name Total purchases for 5 months
"Harry Jones" 1350
"Henny Penny" 1000...
Does this make sense??
Basically I want to be able to calculate their total purchases from the input text file using VB6 and then output these calculated totals to another text file.
What is the quickest & easiest way to do this??
Thanks for any help I may get!
Cheers!
Opening Text File, Outputting It To Textbox
How do I open a textfile, and have it's contents outputed to a textbox? The path must be file.ext .. I looked at some of the tutorials but didn't find a direct example, tried
Dim checkfile As String
Open App.Path & "conf.cfg" For Random As checkfile
txt1.Text = checkfile
which didn't do anything, was a longshot : ... also conf.cfg, textfile saved with the extension .cfg, shouldn't be problem ...
Outputting Strings To Human Readable Text
How to I output strings as readable text in notepad
i'm using this type of output
Open "c:currentList.txt" For Random As #1 Len = 1000
put #1, 1, variable1
close #1
but this outputs as... machine language..?
Outputting Data From A Datagrid Into A Text File?
How would you go about this. I have never made a report before so I was wondering if you could tell me the best way to do this. I have a datagrid that contains data, it is logs of events happening in my program, like login, logout, etc, and I am trying to create a function so the user can export the logs to a text file. If you could help I would be very grateful
Thanks
Freezing Richtextbox From Scrolling While Outputting Text
Hi all ... just wonder if there is any codes out there that can freeze the richtextbox from scrolling when outputting a long string of text.
My problem is when outputting a large amount of lines into a richtextbox, it tends to scroll along the last line of input. I want it to be fixed at the top of the richtextbox when outputting. Sometimes .. it remains at the top ... but sometimes .. it follows the last line ... this is weird ... probably due to the system graphic memory ...
Appreciate if anyone can tell me how to freeze the richtextbox when outputting.
Thanks !
Chris
Help On Outputting Text File From Excell Cell
I am trying to output the text in excell cells.
For example how do you output text file
A B
1 2 Hello
2 5 Hi
3 28 Good
How can I output a tex file containing B1 with the
file title of A1. I also want to make separate text
files for each row.
Any advice of Help would be appriciatted
Thanks
Kuni
Outputting Text From A Textbox To The Default Printer
I would have thought it might be easy to print out the contents of a textbox, and maybe it is, maybe I missed something, either way, how can I take the contents of a textbox in a form in excel and output that to the printer?
Thanks,
-Heathen
Help Outputting Text File Info To A Listbox
Ok, so I've come up with a program that reads in a list of names and sorts them in ascending or descending order according to the option buttons selected by the user. The only problem is I'm having some trouble outputting this information to a list box so I have no idea if my program works or not. I was hoping maybe someone could tell me what it is that I need to do to get this to output. Could it have something to do with the People subroutine?
Thanks in advance!
Rich Text Box Bold Text Problem
Hi,
My program searches string in RTB and make it bold.
Code:
text1.find("abcd")
text1.selbold=true
text1.selunderline=true
what happen when I search another string old string bold become false and new string bold become true automatically. I want to keep all selected string bold and underline.
how can we do that?
hope someone answer me
Thanks
syed
How Can I Save A Text File With Bold Text In It
Hy... i have to make a report and write something like this:
blah blah=value
and then open it in winword.
The opening part i know, but how can i save the file with this format?
I don't have a richbox control in my form and if it is possible i don't want to use one.
Thanks in advance.
Text In Bold With Vba
I write a text to a word file with vba. But how can I write the text to the word file in bold
Outputting Text To A Text File With Quotes &" &"
Hello,
I do not know what to search under in google for this.
I want to write to a text file a few lines like "hello" (It won't really say hello, that is an example).
However, in VB the Print #1, "blagggggg" doesn't like Print #1, ""Hello""
How do I complete this?
Thank you,
Scott
Rtb Bold Text Not Using Selbold
I want to use a rtb, and only make some bits of text bold.
I downloaded the RTF document here:
http://www.xtremevbtalk.com/atta...tachmentid=205
which is VERY useful! Using the "{ text here}" syntax I should be able to achieve what I want, but I need some more help, as I can't find any on google, or in the forum!
I'm using this:
Code:
WelcomeText = "{{ Welcome to blah blah!}" & _
"{line}{line}line 2 here which should be non-bold" & _
"{line}{line}{ and this is bold again.}" & _
"{line}{line}etc}"
this is all I've figured out from the document I downloaded. But I think I need to use headers, but I'm really not sure!
Using the code above other text which is similar (and changes depending on different buttons clicked) becomes ALL bold, instead of just the parts I need.
Being new to this rtb syntax I'm struggling! Anyone know anything about this?
Help Making Bold Text In RTB
Hi there!
I have a small problem making bold text in a rich text box. I am looping through a string array and making the matching words bold, however if it finds a partial word then it will 'bold' the wrong thing. Here is the partially working code:
Code:
For i = 0 To UBound(rWord()) 'string array
If InStr(rtb1.Text, rWord(i)) Then
b = InStr(rtb1.Text, rWord(i))
rtb1.SelStart = b - 1
rtb1.SelLength = Len(rWord(i))
rtb1.SelBold = True
End If
Next i
So if the word "beer" and the word "bee" is in my text and the word "bee" is in my array, it will end up like this:
"Here is the word beer and the word bee."
Is there a way to come up with a more exact match? I've been looking at this and scratching my head.
Thanks for looking
Max.
Rich Text Box - Bold
Hi
If I have a string called strName and strText, how could I make the rich text box rtbText contain
strName (in bold) & ": "
and
" " & strText
So basically the prob is the bold
Cheers!
Bratch
API - Bold Menu Text
Can anyone help me with how to use an API call to make the text in a menu BOLD?
RTB - Make Whole Text Non-bold At Once
Hey,
I was wondering if it's possible to make the entire text in an RTB 'non-bold' (SelBold = False) all at once, without selecting the entire text and then setting SelBold to false...
I'm trying to create a 'bracket-shower' which in short:
- checks if the cursor is infront of a { bracket
- If yes - make that bracket bold
- If no, make the entire text non-bold (or in other words, 'delete' the boldness of any possible bold { brackets)
At the moment I'm using the following code:
vb Code:
Private Sub rtb_SelChange()Dim lSelStart As LonglSelStart = .SelStart 'This will make the selected bracket bold With rtb .SelStart = 0 .SelLength = Len(.Text) .SelBold = False .SelLength = 0 .SelStart = lSelStart If Mid$(.Text, lSelStart + 1, 1) = "{" Then 'Cursor in front of opening bracket 'Make bold .SelStart = lSelStart .SelLength = 1 .SelBold = True .SelLength = 0 End If End With End Sub
But obviously there are problems with the first part (making the text non-bold). Longer selections don't work (since the sellength is set to 0 directly after selecting...) and things like that... Also, sometimes, the selecting procedure can be seen by the user (you can see the text getting selected )
So is there any way of doing this?
Bold Text In MSFlexGrid
Hello All,
I have an MSFlexGrid with several rows. What I cannot seem to get is for the first row, Row 0, to be bold and the other rows to be normal. I either get all or nothing bolded. Code tried:-
MSFlexGrid1.row = 0
MSFlexGrid1.Font.Bold = True
MSFlexGrid1.row = 1
MSFlexGrid1.Font.Bold = False
etc.
Tarablue
Bold Text In Treeview
hey, does anyone know how to change the treeview text into BOLD, which is considered as Default value in my case
thank a lot for any suggestion1
Bold In Rich Text Box
i have a chat client and i want to have the username of the message highlighted in bold which i have done with the following
VB Code:
temp = InStr(Right(data, Len(data) - 4), " ") RichChat.Text = RichChat.Text & vbNewLine & Right(data, Len(data) - 4) RichChat.SelStart = Len(RichChat.Text) - Len(data) + Len(vbNewLine) RichChat.SelLength = temp RichChat.SelBold = True
except after its ran again. it unbolds the first bold its allready done then rebolds the newest row. how do i keep my old bold's as well as my new bold?
Bold Text In Menu ???
Hi everybody !
In the pictures below, I want to set in bold the text in the 2 boxes ?
I searched on this forum and I found only that I can use PopupMenu Method.
PopupMenu does'nt work, maybe it's not the good method or I dont know how to use it ???
Thanks in advance !
Making Text Bold
Hey, I wrote a script which makes the font in a text box bold one a button is clicked
VB Code:
ElseIf Button.Key = "Bold" ThentxtMain.FontBold = True
Theres a bit of it for you, but I am not sure how to make it unbold, I tried using variables to do it but it didnt work, this is what I did to try and make it unbolden when pressed again
VB Code:
ElseIf (Button.Key = "Bold") & (ModBold = False) ThenModBold = TrueElseIf (Button.Key = "Bold") & (ModBold = True) ThenModBold = False
if ModBold was true then the text would be bold otherwise it wouldnt be, any ideas?
Bold Text In Toolbar
In my select case coding for my toolbar, how do i write the code to make the selected code in the rtb bold?
Aslo italic and underline.
Thanks
Bold Certain Text In RichTextBox
Ok, I have a chat program and I want to bold the username.
I'm guessing I won't be able to send bold text, so here is the recieve sub.
VB Code:
Private Sub sockConn_Read(Index As Integer, DataLength As Integer, IsUrgent As Integer) Dim strBuffer As String Dim cchBuffer As Integer Dim nPos As Integer, strEol As String Dim scrolldown As String cchBuffer = sockConn(Index).Read(strBuffer, 1024) If cchBuffer < 1 Then Exit Sub g_strBuffer(Index) = g_strBuffer(Index) + strBuffer strEol = Chr$(13) + Chr$(10) nPos = InStr(g_strBuffer(Index), strEol) If nPos > 0 Then textOutput.SelStart = 65535 textOutput.SelLength = 0 a = Len(textOutput.Text) textOutput.SelLength = a textOutput.SelText = Left$(g_strBuffer(Index), nPos + 1) g_strBuffer(Index) = Right$(g_strBuffer(Index), Len(g_strBuffer(Index)) - (nPos + 1)) End If End Sub
I don't know exactly whats going on the above code, but I think the last 3 lines have to do with displaying the text.
Text thats sent will be like,
Username: Message
I need to bold "Username:"
Of course "Username" will vary... although I think that max is like 10-15 characeters.
Can anyone give me some code that could do this??
Thanks a Billion
Msgbox Text In Bold
Hi
Is there any way to display the text of message box in Bold.
any API calls, tricks,ideas.
Thanks.
Menu - Bold Text
hy, how can i create a Bold text in my menu .. like popup!!``
thx Longbow
Message Box Text In Bold
Hi,
Msgbox "You are about to delete 1 record(s)" & vbcrlf & " Are you sure? "
In the above statement, I want the text "You are about to delete 1 record(s)" alone in bold.
How to do it?
Iswaria.
Message Box Text Should Appear Bold
can anyone tell me how to make messagebox text as bold
or, part of text in messagebox should be bold
ex,
if the text is hello how are you
i want how to be bold
Bold Text In Menu
How can I make a menu caption bold but only the specified one?
Edited by - TankMaster on 3/11/2004 7:08:13 PM
Message Box Text In Bold Using Api
Hi,
Msgbox "You are about to delete 1 record(s)" & vbcrlf & " Are you sure? "
In the above statement, I want the text "You are about to delete 1 record(s)" alone in bold using API and not through custom Messagebox using forms.
How to do it?
Iswaria.
Bold And Coloured Text
Hi, this is a simple question but i cant find the answer anywhere
i want to make a string a different colour. I have 2 text string to place in a text box. I need them to be 2 different colours. Therefore i cant set the text box foreground to a colour
can someone help me please
thanks
|