Take data from a website and display in a program.
-
So i've slowly been learning c# over few months but going slow and is my first language. One thing i would like to know, is how it would get a c# program to take data from a website then display inside the application. (Not taking data from a database) Could anyone possible point be at examples or tell me roughly what i would have to do. Thanks in advance, Malcom
-
So i've slowly been learning c# over few months but going slow and is my first language. One thing i would like to know, is how it would get a c# program to take data from a website then display inside the application. (Not taking data from a database) Could anyone possible point be at examples or tell me roughly what i would have to do. Thanks in advance, Malcom
Hi, there are a couple of ways to do that: 1. add a WebBrowser to your form, make it navigate to your URL, then grab its DocumentText. You could do that with a hidden WebBrowser as well. 2. use HttpRequest and HttpResponse classes to access the web yourself. This is faster, but a bit more complex. FWIW: make sure to study a good book[^] on C# :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
Hi, there are a couple of ways to do that: 1. add a WebBrowser to your form, make it navigate to your URL, then grab its DocumentText. You could do that with a hidden WebBrowser as well. 2. use HttpRequest and HttpResponse classes to access the web yourself. This is faster, but a bit more complex. FWIW: make sure to study a good book[^] on C# :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
Yeah i have heard of HttpRequest and Response. I didn't want to use a browser. So on return of the data it is possible to display it differently. For example come up in a textbox or different controls im not really thinking of just now. Thanks for the book recommendation, i'm looking for the best one at Amazon :)
-
Yeah i have heard of HttpRequest and Response. I didn't want to use a browser. So on return of the data it is possible to display it differently. For example come up in a textbox or different controls im not really thinking of just now. Thanks for the book recommendation, i'm looking for the best one at Amazon :)
the response is always a string, it is a text following HTML conventions. :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
the response is always a string, it is a text following HTML conventions. :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
You're welcome. :)
Luc Pattyn
:badger: :jig: :badger:
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
:jig: :badger: :jig:
-
So i've slowly been learning c# over few months but going slow and is my first language. One thing i would like to know, is how it would get a c# program to take data from a website then display inside the application. (Not taking data from a database) Could anyone possible point be at examples or tell me roughly what i would have to do. Thanks in advance, Malcom
You can use ADO.NET to create database for the website, and then connect to it with the C# application. or you can do someting that call "web service" - open new ASP.NET Web service in your Visual Stduio, there, you can define methods that after you can call to then with your C#. after you finish define, go to the C# project, and then on the solution explorer->referance of the project click left mouse, click "Web referance", and look for your web service address, then you can use all the methods you defined.
Gindi Bar Yahav - Web & Software developer.