|
string URL = "http://www.somepagegoeshere.com"; //the url
HttpWebRequest PageRequest = (HttpWebRequest)WebRequest.Ceate(URL); //some fun web stuff
WebResponse PageResponse = PageRequest.GetResponse();
StreamReader r = new StreamReader(PageResponse.GetResponseStream()); //here we go
string theDownloadedPage = r.ReadToEnd(); //and it's downloaded
r.Close();
I didn't test it but it looks right.
|
|
|
|
|
oh, and you are using System.Net;
|
|
|
|
|
Thank Guys for your help...
---------------------
Areff Bahrami(KAVEH)
Areff.HB@Gmail.com
---------------------
|
|
|
|
|
hai i want to check whether the given id exists in the data base ,if exists it should proceed if not it should give error message.its a window based c# application.iam using comand reader but its giving error.
|
|
|
|
|
Can we get the Edit,Delete,Add buttons in the grid of the windows application?
I mean, as soon as i am clicking on any of the buttons, it is getting redirected to another form.
But, I want the actions to be performed in the same grid.
If it is possible please send solution for my problem.
|
|
|
|
|
Hi.
i need to close an application if there is no user activity on it for an amount of time. (loop through the open applications and close the ones with no user activity)
I can do it with:
- a global variable in wich to put the time of the last keypress or mose move
- timer that checks to see if there are any new applications or that the open ones closed in the mean time, and to see if the difference between now and the last user access is greater than the configured value.
it looks simple, but I have a problem:
- how to get the last user input on a form FROM ANOTHER APPLICATION
Thanks in advance.
|
|
|
|
|
Hi
I wrote a web service in C#. Now I want to install it on another PC. How do I do that?
Here is what I have done:
a) From my development PC, I copied the WS folder to the other PC.
b) Went into Internet Information Services and created new a new Virtual directory that points to that folder.
Problem is I can't get the web service to work. When I open my internet exploer and browse to http://localhost/MyWebService/Item.asmx, I get just <%@ WebService Language="c#" Codebehind="Item.asmx.cs" Class="Retalix.StoreLine.WS.Item" %>
Thank you.
|
|
|
|
|
The other machine will need a web server up and running, ala IIS. If you've got IIS installed, make sure the default website is started and that the IIS service is started.
|
|
|
|
|
Thanks.
IIS is installed on the target machine, default web site is started, and the World Wide Web Publishing service is also started.
Still, when I browse to my service, i get a page with just the contenst of item.asmx:
<%@ WebService Language="c#" Codebehind="Item.asmx.cs" Class="Retalix.StoreLine.WS.Item" %>
This PC is a Win2000 professional, with no visual studio .net on it - only .NET framework 1.1.
I tried the same steps on another PC, XP professional with .NET framework 1.1 and it works OK there.
could it be an operating system issue?
thank you.
|
|
|
|
|
I don't know; I'm not sure of the requirements there. Such a question might be better suited for the ASP.NET forum.
|
|
|
|
|
How can i ping a computer that is on my network to see if it is connected. i have used a ping command so far but this takes too long. all i need to know is true/false if it is connected or not but the emphesis is on speed.
Thanks to anyone who can help me.:->
|
|
|
|
|
use the ping command itself,but set the timeout value in it...refer ping command syntax
|
|
|
|
|
Hello. How can I get a treeview with the information from a webservice that return a SQL query from a database?
Thanks
|
|
|
|
|
Hi
I make a Help File with Html
I let a Help Menu in menu strip
Then I add a Help Provider Object to my project
Now I wnat to know how to work with this help provider to show the help file when i select the help menu.
thanks
F.Hashemi
|
|
|
|
|
I made a Form called "DVSettings" its in my Information_Device. What I want it to do:
I have a ComboBox called: cmbVisual. What I want is when you click an Item on it like:
Style XP2
It will change an Image in picturebox (pctWallpaper) in Form: VisualApplication.cs Which is part of Information_Device. How would you do that?
In the end we're all just the same
|
|
|
|
|
Hi All,
I want to change the default button control and context menu of a openfiledialogbox with my custom menu and button control. How should I implement it? Should I design thea new openfiledialogbox from scratch? Thanks in advance for any kind of sugession.
Anindya Chatterjee
|
|
|
|
|
You would be better off customizing this without reimplementing from scratch. I have done this in a C# project of mine and it works well. It does involve some extensive interop. Here is a link to an article about customizing this dialog. It is written in C++ but you can also do this with interop.
http://www.codeproject.com/dialog/customize_dialog.asp[^]
I hope this helps you get started.
Deus caritas est
|
|
|
|
|
Hello,
I am trying to let my main thread insert some records in a SQL database and a background worker will keep on scanning the SQL and read a record, do some work based on that record and after that, the background worker will delete that record and scan for new record. Now My question is, should I have to go thru any lock mechanism or (Although I am not familiar with lock mechanism) this process will workout without any conflict. !!
-- modified at 4:24 Wednesday 22nd February, 2006
|
|
|
|
|
No, you shouldn't have to do any synchronization with the lock keyword. You would use lock if two threads or processes were accessing shared memory; in your case, however, no shared memory exists. You use the database as a one-way buffer for the information, if I interpret your description correctly.
Now, if the database did not have ACID[^] compliance, then you'd have a problem.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hello,
I have seen that Background worker has an event handler for Progress Changed, but I found that, I will have to write code in DoWork method to report progress. But many method is a very time consuming method where i dont know the progress ( example : Sending email ), how can I make Background wroker determine the progress of its work ? Is it not possible ?
Thanks
Emran
|
|
|
|
|
Hi Emran,
The following gets the progress on interating thru Controls on a form....Something like :
private int progressBarIndex;
private void StartWorker()
{
//Set progress Bar stuff before running thread
this.myBar.Value = 0;
this.myBar.Minimum = 0;
this.myBar.Maximum = 100;
//Set the thread going
this.worker.WorkerReportsProgress = true;
this.worker.RunWorkerAsync(this.Controls.Count);
}
private void LoopThruControls()
{
foreach (Control control in this.Controls)
{
Console.WriteLine(control.Name.ToString());
//Update progress
this.workerReportProgress();
}
}
private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
//Call this method when thread begins
this.LoopThruControls();
}
private void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
//Update the progress bar
System.Diagnostics.Debug.Assert(InvokeRequired == false);
this.myBar.Value = e.ProgressPercentage;
}
private void workerReportProgress()
{
this.progressBarIndex++;
this.worker.ReportProgress(progressBarIndex);
}
.. then use worker_RunWorkerCompleted to Finish..
HTH
Jonny
|
|
|
|
|
Hi jonny,
Thanks for reply.
Ok, In your code,
foreach (Control control in this.Controls)
{
Console.WriteLine(control.Name.ToString());
//Update progress
this.workerReportProgress();
}
I will have to call workerReportProgress() in the lenghy work function. It is ok if my lenghty work function is lenghty just because of infinite or long numbered for loop. But What about a lenghty work which is lenghty by itself (without for loop) ! My problem is like,
void lenghyFunction()
{
sendEmail();
}
HEre, sendEMail is very lenghy itself (becasue of huge attachments etc..), now how can i call reportProgress method of BW as it is not any forloop.
Thanks and regards
Emran
|
|
|
|
|
What you need is to ge tthe progress of the SendEmail method, unless that reports progress, then you are not going to be able to.
Often there is an equivalent BeginSendMail() method which would start it asynchronously, and perhaps report progress as an event.
|
|
|
|
|
Hi J4amieC,
Thanks for the reply. Yes, you got it. I guessed that C#.NET's background worker is smart enough to determine the percentage of work it is assigned even though i did not make my sendEMail function progress reportable. Now it looks like, what I was expecting is impossible unless I make my sendEMail function progress reportable or any method of .NET i am using which reports progress. Right ?
|
|
|
|
|
Hi Emran,
Yes I agree with J4amieC - expose the email progress through (I assume your using Ouklook) the Outlook interop...
Why not have 2 progress bars - 1 containing overall progress (All Emails) and 1 containing progress for 1 Email (this is of course assuming you can expose progress)....and what about a Status Bar, containing a label updating the updating user in text - e.g. 'Sending 1 of 10 emails...' etc
HTH
Jonny
|
|
|
|