-
Oct 19th, 2007, 08:56 AM
#1
copying vbcode from posts
if you get annoyed at the line numbering in the vbcode boxes when copying to paste elsewhere
vb Code:
Sub Main()
Dim myarr() As String
myarr = Split(Clipboard.GetText, vbNewLine)
For i = UBound(myarr) To 0 Step -1
If IsNumeric(myarr(i)) Then myarr(i) = ""
Next
Clipboard.Clear
Clipboard.SetText Replace(Join(myarr, vbNewLine), vbLf & vbCr, "")
End Sub
make a project with the above code (no form needed) and compile
copy from the post
run program (nothing visible happens)
paste into whatever code window
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 19th, 2007, 09:37 AM
#2
Junior Member
Re: copying vbcode from posts
dam thats a good idea, sick to death of the rsi-deleting needed when using posted code!
-
Oct 19th, 2007, 09:39 AM
#3
Re: copying vbcode from posts
Moved to the CodeBank
You don't need to do any deleting or formatting.
If you want a piece of highlighted code, click the quote button. The post you are "quoting" will be displayed in plain text. Just copy the code and then cancel out of the quote.
-
Oct 19th, 2007, 09:45 AM
#4
Junior Member
Re: copying vbcode from posts
true.. but doing it that way you get stuck with place holders you need to remove, westconn1s way has none .. guess it depends on how lazy you are.. and I am lol
-
Oct 19th, 2007, 10:01 AM
#5
Re: copying vbcode from posts
-
Oct 19th, 2007, 10:03 AM
#6
Junior Member
Re: copying vbcode from posts
HIGHLIGHT and QUOTE and all the [ and ] bits
-
Oct 19th, 2007, 10:11 AM
#7
Re: copying vbcode from posts
Oh please, you don't copy those, you just copy what is in between them.
-
Oct 19th, 2007, 10:20 AM
#8
Junior Member
Re: copying vbcode from posts
Down to preference then, I prefer the code way, saves me clicking off the post too
-
Oct 26th, 2007, 05:14 PM
#9
Re: copying vbcode from posts
Si_the_geek's VBCode program works even faster. Highlight the code you want to copy and copy it with Alt-C. (I have the program running on startup.)
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Oct 27th, 2007, 12:27 PM
#10
Re: copying vbcode from posts
-
Oct 29th, 2007, 07:41 PM
#11
Re: copying vbcode from posts
Nice and simple westconn1!
Just needed to add, dim i as...
-
Dec 4th, 2007, 09:49 AM
#12
Fanatic Member
Re: copying vbcode from posts
Why not just have the forum guys fix the problem. Take those line numbers out. What is the point of them anyway? We used to be able to copy and past code from the forum with no problems.
-
Dec 4th, 2007, 10:21 AM
#13
Re: copying vbcode from posts
It's not as simple as that unfortunately - the current version of the forum software does not support our our old highlighting method, and there aren't options for how the current one works.
The current method is a decent replacement, even with this relatively minor issue. The development team had various issues to deal with here when we upgraded, and finding/implementing that highlighter was more than they were required to do (they could have just left us with Code tags). As they work on multiple sites (including about 30 forums) which have their own issues, something like this isn't at the top of their list.
There is work in progress to modify the highlighter to deal with the line numbers (and other minor issues such as colours), but as it not overly simple, and is being done by a moderator (thus voluntarily), it is not something which will happen immediately - but hopefully will be complete in the near future..
-
Dec 6th, 2007, 09:55 AM
#14
Fanatic Member
Re: copying vbcode from posts
I can understand that. This looks like VBulletin forum software. I primarily use PHP forum software which is open source and customizable..but does have draw backs. Perhaps the VBulletin folks can address the issue. It is a big deal in particular for this forum in which programmers indeed like and need to cut and paste code samples quite frequently. That is just my 2 cents. This has always been a great forum...so don't take this as a complaint in a broad regard.
Thanks!
-
Dec 6th, 2007, 12:56 PM
#15
Re: copying vbcode from posts
It is vBulletin (see the section at the bottom of the page), and it is customisable.. which is why the syntax highlighter (provided by someone else) is available. The issue is with the flexibility of the highlighter, rather than the forums software itself.
The problem is that while language specific code tags are certainly useful to us, they are not essential (as the standard Code tags could be used - like on many other sites). As such they are not a top priority for the team who keep this site (and several others) operational; we were lucky they did as much as they have done - as they weren't required to do it.
I understand and agree that the current issues are annoying, but they are not a "must fix", as there are various workarounds like the ones above.
As I said tho, the implementation is being "corrected" by a volunteer (who has lots of relevant knowledge/experience in this area), and will be hopefully be updated fairly soon.
-
Feb 22nd, 2008, 02:19 PM
#16
Re: copying vbcode from posts
Pressing [QUOTE] and copy/paste works well, thanks!
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|