I am trying to retreive data from a webpage with a label saying "export". The data is partially showing on the screen, if I manually click on "export" a window comes up and ask to save, save as, or cancel. I then save all data to my computer as a csv file. However when trying to get the data using c# I get the code behind "export" and not the data, code starts out as "".
I am using the following code:
WebClient webClient = new WebClient();
webClient.UseDefaultCredentials = false;
webClient.Credentials = new NetworkCredential(strUsername, strPassword);
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
*note url is for "export".
Can someone please point me in the right direction.
Any help will be greatly appreciated.
Thanks in advance.
One thing might be happening here is that the website expects you to reach to file from the page where the button is. Can you add appropriate (that page's URL) referrer header to your request and check?
The following is the website:
"http://finviz.com/screener.ashx?v=150&ft=4" however you have to pay for the service to get data, which will be "http://elite.finviz.com/screener.ashx?v=150&ft=4".
Find the button export the url on that is "http://elite.finviz.com/export.ashx?v=150&ft=4"
This is the actual url I use then add or don't add ".csv".
if I enter the url in my browsers command line, the file is downloaded, but when I use c# I get html code.
You have a global variable speachsynthesizer (ss) that you configure on button1 then on the actual record button4 you create a new LOCAL variable speachsynthesizer of the same name (ss) that you do not configure but use that to speak the text.
The Record button is used to save text inside textBox!
I have replaced varibles from button1 and button4 with SpeechSynthesizer ss = new SpeechSynthesizer(); as global varible but still not working!!!!
If you now have two lines like this in your code, that's not correct. You only need to declare it once, in the Form_Load. So, you have a member variable called ss (that's a poor choice for a name - why not just call it speechSynthesizer), and in your Form_Load you have ss = new SpeechSynthesizer. That's it - that's the only place you should see the new Synthesizer() call.
Exactly. That's a bug in the language specification of C# which can cause bugs in the software which are very hard to find. Fortunately, ReSharper can issue a warning. And a well designed style guide should suggest different styles for fields vs. local variables.
Do you expect other's to write the code for you? It ain't work so here.
But it is quite simple. Give it a try:
Iterate over the array items using another iteration for each item looking for equal numbers. With equal numbers get the distance and check if it is larger than the previously detected maximum distance.
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
But without giving you any code, I'll tell you how I'd do it: I'd create a struct to hold each distinct value and a sorted list of indexes in the array. I'd then fill out a collection of such structs - one for each distinct value in the array - and traverse the collection when complete to find the largest difference in indexes.
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
Last Visit: 31-Dec-99 18:00 Last Update: 22-Sep-23 18:54