|
There is no tool. You have to rewrite the code from scratch.
|
|
|
|
|
They are quite different. You would really not do a line to line conversion. Hence no tool would help. You will need to spend time and do it yourself.
|
|
|
|
|
Hi,
How can I get the 'pointer' of the stream writer the webbrowser control uses to navigate to websites?
Thanks in advance!
|
|
|
|
|
I *think* the DocumentStream[^] property is what you're looking for. Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
I thought that's the one i needed too. But where would i put the url to navigate to another url with it?
|
|
|
|
|
Yustme wrote: But where would i put the url to navigate to another url with it?
I'm not sure if I understand this, but to navigate to another URL, you call the Navigate method of the webbrowser control, passing in the URL to navigate to, like so:
webBrowser1.Navigate("http://codeproject.com"); Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Ideally would be using the response class. Its much faster. But i can't log in on a website with it.
I got a multithreaded application. When entering the event: WebBrowserDocumentCompletedEventArgs , another thread already navigated to another page. So i'll lose the last page where the webcontrol navigated to.
Making the threads sleep a few seconds, doesn't help either. All i'm trying to get is the page content in html format.
|
|
|
|
|
Yustme wrote: All i'm trying to get is the page content in html format.
By that, do you mean getting the HTML behind the page?
If so, the DocumentText[^] property is what you need. It also allows you to modify the HTML contents, but I'm not sure if it's gonna work with what you're trying to accomplish:
Yustme wrote: But i can't log in on a website with it.
You may wanna have a look at the HtmlDocument[^] class. Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Yes i can get the html code from the page. But i need to navigate to it first.
And there are a lot of pages to walk through.
|
|
|
|
|
What exactly are you trying to create? Perhaps the WebBrowser control isn't the ideal solution for this, but that depends on what you're trying to do. Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Getting html code of a topic in a vbulletin forum.
If you're not logged in, you're not allowed to view the topic.
I can't log in with the response class.
This was my try:
private string login(string url, string username, string password)
{
string values = "vb_login_username={0}&vb_login_password={1}";
values += "&securitytoken=guest&cookieuser=checked&do=login";
values = string.Format(values, username, password);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = values.Length;
req.Timeout = 10000;
CookieContainer a = new CookieContainer();
req.CookieContainer = a;
System.Net.ServicePointManager.Expect100Continue = false;
using (StreamWriter writer = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII))
{ writer.Write(values, 0, values.Length); }
this.response = (HttpWebResponse)req.GetResponse();
StringBuilder output = new StringBuilder();
foreach (var cookie in response.Cookies)
{
output.Append(cookie.ToString());
output.Append(";");
}
return output.ToString();
}
</pre>
|
|
|
|
|
I don't know why your login request doesn't work, but another approach to the problem could be:
1. Navigate to the URL using the WebBrowser control.
2. If a login form is displayed, use HtmlDocument to fill in the values (username + password) and "click" the Login button. Depending on how the site is coded, the browser should automatically navigate to the requested forum topic.
3. Grab the HTML by using the DocumentStream property.
Although this definitely isn't the most ideal solution if you have to "visit" several sites. WebRequest is probably the way to go if that's the case.
Have you got any idea as to why your login request fails? Does the site display an error message? Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
Im already filling the form's manually in the webbrowser control.
My idea why the login fails is because of the 'salt' it adds after the password.
And it gets the salt from the DB.
If i could fill in the forms programmatically with webresponse and request, would be great.
This way, i dont have to load anything, which takes a lot of time.
|
|
|
|
|
Hi,
This is my code.
I'm a newbie to c# and I have been working on this for a few days.
{
readText = File.ReadAllText("C:\\PIn.txt");
string [] split = readText.Split(new Char [] {' '});
int splitCounter = 0;
foreach (string s in split)
{
splitCounter++;
if (splitCounter == 1)
bn1 = double.Parse(s);
if (splitCounter == 2)
bn2 = double.Parse(s);
if (splitCounter == 3)
bn3 = double.Parse(s);
if (splitCounter == 4)
bn4 = double.Parse(s);
}
Print("Pn: " + pn1 + " " + pn2 + " " + pn3 + " " + pn4);
As you can see I've used Print to make sure it is working but I am having a huge amount of trouble moving forward...please help. It's an important step for me.
Regards,
suprsnipes
|
|
|
|
|
Yes, ok, it's some code.
What is the problem - apart from "it doesn't find the nearest number above in comparison to another" which is a bit obvious, given there is no comparison in there...You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Can you explain what are you trying to do a little better ...
|
|
|
|
|
A couple of *gentle* hints, when posting to boards such as this.
1. Say what is wrong in the body of the question, if it is in the title it will get missed.
2. suprsnipes wrote: It's an important step for me. Saying this is likely to cause a flamewar (look at the posting guidance at the top of the board).
OK I don't fully undstand what the requirement is. Is
a) find the two items (or their position/index?) in the list adjecent to eachother that are closest in value where the second is higher than the first?
b) find the two items (or their position/index?) accross the whole list that are closest in value where the second is higher than the first?
An example would be helpful.
As a first pointer, you will need to keep the index of the closest two and update it if you find a closer pair inside the loop you have.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
I don't understand what your problem is with this. You had the code two days ago, I tested it and confirmed that it provided the result you wanted. And yet you keep coming up with a different (and ridiculous) algorithm and asking why it doesn't work.
May I suggest you stop writing code and work this out as a mathematical problem. Then write down the steps to solve it using simple mathematics. Then, and only then, convert your steps into code.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
For your information the code DIDN'T work. If it did I wouldn't be asking for help still...
|
|
|
|
|
Do you want to
Print("Pn: " + pn1 + " " + pn2 + " " + pn3 + " " + pn4);
or
Print("Pn: " + bn1 + " " + bn2 + " " + bn3 + " " + bn4);
?
|
|
|
|
|
I was using to Print to help me see what the code is doing and if I am on the right track...
Print("Pn: " + pn1 + " " + pn2 + " " + pn3 + " " + pn4);
The text document has numbers stored in it that I want to use in another piece of code which is already prepared but I am having a huge amount of trouble trying to get the number from the data set that I need.
|
|
|
|
|
I think what KenKen Wong was saying is: Your code will either not compile or not work as you expect, because you are putting information into bn1..bn4, and printing from pn1..pn4.
suprsnipes wrote:
if (splitCounter == 1)
bn1 = double.Parse(s);
if (splitCounter == 2)
bn2 = double.Parse(s);
if (splitCounter == 3)
bn3 = double.Parse(s);
if (splitCounter == 4)
bn4 = double.Parse(s);
}
Print("Pn: " + pn1 + " " + pn2 + " " + pn3 + " " + pn4);
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
suprsnipes wrote: For your information the code DIDN'T work.
So I lied! Good luck, you'll need it.txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Thanks for the reply...
I'm not here to upset anyone just trying to get some help, coding might come easy to some, especially those that have been at it for years (I've been using C# for about 2 weeks), perhaps I should have said "the code didn't do what I required".
I use Print so that I can see the output and for some reason the suggested code was rounding down...I don't know why that is...so I placed what I had on the message board in hope that another member would be kind enough to give me some assistance...
My intention was not to offend anyone, surely you guys remember what it was like starting out?
suprsnipes
|
|
|
|
|
suprsnipes wrote: For your information the code DIDN'T work. If it did I wouldn't be asking for help still...
Perhaps it was this that raised the ire. The is a whole ettiqute involved with bulletin boards, and you've broken a few of them (e.g. reposting). Read the guidance at the top of the page. You also need to remeber that the regulars here frequently deal with students whose attitude is "I can't do my homework so here is the the question I've been set" normally finished with "This is urgent snd codez plz". I don't think your OP was like that, but we're all a bit jaded in here, and some people reuse to help students at all as they should be working this stuff out for themselves.
suprsnipes wrote: surely you guys remember what it was like starting out?
Yep. But the problem is you posted code that wasn't even close to to achieving what is needed (for examplethere is no comparison at all of the values ) and you haven't properly explained what you want, and (because the code isn't close) what is going wrong.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|