Expression Expected for Copying to clipboard - visual-studio-2010

My first time being here.
I have a VB Project, and I want it to Auto Copy when the Link is changed. But I don't want it to copy at start. I tried making this, but I got the "Expression Expected" error.
Code:
If txtImgurLink.Text = "Imgur URL" Then
End If
If Else Then
Clipboard.SetText(txtImgurLink.Text)

You put an If followed by an Else, and that's not allowed on VB.
Try this instead:
If txtImgurLink.Text <> "Imgur URL" Then
Clipboard.SetText(txtImgurLink.Text)
End If

Related

VS 2017 error: "Attempted TextBuffer edit operation while another edit is in progress"

As the title suggests, I often get the error when I try to edit code after running the program. I have to restart VS to make it work again.
Any other solution?
Closing and opening the file again should resolve the issue.This may be caused by an extension or may be "ActivityLog.xml" is lock to write by other process. Don't need to restart VS just current file.
In my case, I have the text:
#(#*refs.tipo + " - " +*# (refs.tipo == "I" ? "Investigando" : "Encerrado"))
I replaced it with:
#((refs.tipo == "I" ? "Investigando" : "Encerrado"))
And it worked.
In my case, I was trying to edit a comment in a .cshtml in VS 2019 #**# and whit the second character inside the comment the error popped up, so I had to write it first and then comment it.

How to put URL in helpfile into MsgBox function?

I want to have a URL in the helpfile part of the VBScript MsgBox() function. How do I do that?
Here is the code:
Dim error
Dim helpPath
helpPath = "http://www.example.com/example-support-page"
error = MsgBox("There was an error doing whatever.", vbSystemModal + vbCritical, "Uh oh!")
helpPath = MsgBox("", vbSystemModal + vbMsgBoxHelpButton, "", helpPath)
I used this answer and it worked:
Not sure of any way to get a hyperlink into a msgbox. However, you can format your msgbox as 'Oops - shall we go to the help page?' and use Yes/No buttons then code the 'Yes' option as and open() command with the URL as the parameter to invoke the browser to open via the OS. No reason why that would not work.
- Vanquished Wombat
(I copied and pasted it because I can't seem to mark a comment as an answer.)

Having trouble in getting input from user in Ruby

I have a method which check if the file exists, If the file does not exist then it should call another method which prompts the questions. Below is the sample code.
def readFile1()
flag = false
begin
#ssh.exec!("cd #{##home_dir}")
puts "\nChecking if file exists on #{#hostname}\n"
if #ssh.exec!("sh -c '[ -f "#{file_name}" ]; echo $?'").to_i == 0
flag = true
puts "File exists on #{#hostname}"
display()
else
puts "File does not exist. Please answer following questions."
prompt()
end
rescue => e
puts "readFile1 failed... #{e}"
end
return exists
end
def prompt()
puts "\nDo you want to enter the new file location? [y/n]"
ans = gets.chomp
puts "New location is #{ans}"
end
When I am calling readFile method, if the file does not exists, it prints Do you want to enter the new file location? [y/n] and does not wait for the user to enter the value but immediately prints the rescue block and quits. Below is the Output if file does not exists.
Checking if file exists on LNXAPP
File does not exist. Please answer following questions.
Do you want to enter the new file location? [y/n]
readFile1 failed... No such file or directory - LNXAPP
I want the user to enter the values for the questions but it's not happening.Need help in fixing this.
Your code is not ideal.
You should check if the file exists via:
if File.exist? location_of_your_file_goes_here
The begin/rescue is then not required, because
you already check before whether the file exists.
Also two spaces should be better than one tab,
at least when you display on a site such as here.
Reason is simple - it makes your code easier
to read for others.
You also don't need the flag variable if I am
right - try to omit it and use solely File.exist?
there.
Also you wrote:
"When I am calling readFile method"
But you have no method called readFile().
Your method is called readFile1().
I know that you probably know this too, but
you must be very specific so that the ruby
parser understands precisely what you mean,
and that what you describe with words also
matches to the code you use.
Another issue I see with your code is that
you do this:
return exists
but what is "exists" here? A variable?
A method? It has not been defined elsewhere
in your code.
Try to make your code as simple and as logical
as possible.

Can't write tmp files in Heroku/Sinatra

Trying to write a temporary file on Heroku (Cedar), which seems like it should be possible, according to the documentation. Yet this code snippet fails:
get '/test' do
myfile = File.new("./tmp/testemp.txt", "w+")
myfile.puts("Abracadabra")
myfile.close
"End of test"
end
Any suggestions what I might be doing wrong? The "End of test" output shows up on the served web page, so this path is definitely getting followed.
Thanks!
The code you have is writing to the file /tmp/testemp.txt, but you are then returning "End of test" at the end of your method, which is why that is returned to the web browser.
That last thing you return will get rendered to the web browser by default.

VBScript Expected End 800A03F6

I am getting this error while trying to run a VBScript (note this is not in a web environment - just running a VBScript on Windows):
Line: [Last line]
Error: Expected 'End'
Code: 800A03F4
Source: Microsoft VBScript compilation error
I think it is an If statement that is not closed correctly with an "End If," but I've gone through every instance of "If" in the code and cannot find the error. Any tips or tools that could help me figure out where/why this error is occurring?
There was an "Else If" - there should be no space there: "Elseif"
http://www.w3schools.com/asp/asp_conditionals.asp
Hopefully this will help someone out in the future.
In VBScript If is not the only token that requires an End. Also look for Function's and Sub's without their appropriate end statements.

Resources