Ever had the problem of copying VB code into a word file (or other text editor) and finding that all the colour and font formatting is lost?
Well with this you can copy the code into the rich text box and press format and it goes through the contents of the box and changes all comments to green and all the vb Keywords to blue, so it looks just like it does in the VB editor!
Very useful for students like myself wanting to put their in a word file for documentation for coursework etc...
EDIT: Latest version now here:
Last edited by Arachnid13; May 11th, 2005 at 04:41 PM.
Reason: Updating Attachment
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
Thanks for that, i guessed id probably missed some words, ill add them in and post it again next time im online on my pc, ill add the alphabetical sort too. If anyone notices any other words missin then please post them on here so i know.
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
At some point, I think I going to create a Access Db table to hold them. That way, if you actually do "Add" or "Remove" a keyword, it will, or will not, be available the next time you run the program.
yea, the two you gave me yesterday, "Replace" and "Split" dont actually show up blue in the vb editor... i missed "With" as well from the original
Yes, I know, but in so far as the code formatter will be for individual use, anyone can put in whatever they want as highlighted keywords. I've always felt those two should be blue anyway.
yea i guess, well here's the updated version, it sorts the listbox now and instead of using a keyword constant, it accesses the "KeywordList.txt" file, just make sure you either put the file in your vb folder (or in the same folder as the app if u compile it) or change the line "Directory = App.Path" to the directory that you have the file in... (it's in the Form_Load() event)
Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White
Keywords copied+pasted from that wonderful piece of software, Notepad++.
There are a whole lot of VB.NET ones in there as well.
Code:
addhandler addressof andalso alias and ansi as assembly attribute
auto begin boolean byref byte byval call case catch cbool cbyte
cchar cdate cdec cdbl char cint class clng cobj compare const
continue cshort csng cstr ctype currency date decimal declare
default delegate dim do double each else elseif end enum erase
error event exit explicit false finally for friend function get
gettype global gosub goto handles if implement implements imports
in inherits integer interface is let lib like load long loop lset
me mid mod module mustinherit mustoverride mybase myclass
namespace new next not nothing notinheritable notoverridable
object on option optional or orelse overloads overridable
overrides paramarray preserve private property protected public
raiseevent readonly redim rem removehandler rset resume return
select set shadows shared short single static step stop string
structure sub synclock then throw to true try type typeof unload
unicode until variant wend when while with withevents writeonly xor
In Form_Load :
1) There is no need for Directory = "D:\", and you can use this : If Right$(Directory, 1) <> "\" Then Directory = Directory & "\" to make sure you have the backslash at the end.
2) In cmdAdd_Click, to not add anything if the user presses cancel, you can use this :
VB Code:
Private Sub cmdAdd_Click()
Dim i As Long
Dim sInput As String
sInput = InputBox("Enter a new keyword", "Arachnid Software")
If StrPtr(sInput) <> 0 Then
lstKeywords.AddItem sInput
Open Directory + "KeywordList.txt" For Output As #1
For i = 0 To lstKeywords.ListCount - 1
Print #1, lstKeywords.List(i)
Next i
Close #1
End If
End Sub
Has someone helped you? Then you can Rate their helpful post.
In Form_Load :
1) There is no need for Directory = "D:\", and you can use this : If Right$(Directory, 1) <> "\" Then Directory = Directory & "\" to make sure you have the backslash at the end.
Why not simply
Directory = App.Path & "\"
?
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Well, will probably work just as well. You don't check if there is one at the end, you append one anyway. If there is more than one, it will still open the same folder, no difference, so you have a point
Has someone helped you? Then you can Rate their helpful post.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Thank you so much for this! I took out the listbox and just stored the keywords in an array and caught the 'Enter' key (ascii 13) to call the code written here. It works just like the VB editor now! Thanks!
If my post was helpful to you, then express your gratitude using Rate this Post.
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video) My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet Social Group:VBForums - Developers from India