There is an option in Visual Studio (since as far back as I can remember) that allows you to see “Whitespace” in your code. This is often seen in file differential viewers as well.
I’m wondering if anyone knows how this can be accomplished in VB.net (or any other way) so that i could use a similar type of display option in my software.
I have not yet tried to do this but my only first thoughts would be to override the “paint” of the textbox to actually add the little tab “arrows” and space “dots” manually via GDI, or create a texbox control from scratch. Seems to me there could be an easier way to do this.
Any suggestions or solutions are welcome.
Search for the vbTab constant in the entirety of the document and replace them with a small arrow (
→)(drawn with grey or whatev. you want)Do the same for the space char but replace it with a grey dot (
·)if you want to change it back, replace
·with spaces and replace the arrows (→) with tabsafter this is done set a boolean (
useSymbol) to true and use this boolean in the keydown event of the textbox to check whether you should print regular spaces/tabs or·/→