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...
Last Visit: 31-Dec-99 19:00 Last Update: 1-Feb-23 3:10