![]() |
|
#1
|
|||
|
|||
NavigatingThis is for C# actually, but it is basically the same...
C-SHARP / C# Code:
webBrowser1.Navigate(new Uri(website.ToString())); On this line, when I click button 6 I get the error "Invalid URI: The format of the URI could not be determined." Any help? Last edited by LuciWiz : 08-Jun-2007 at 06:23.
Reason: Please insert your C# code between [c#] & [/c#] tags
|
|||
|
#2
|
|||
|
|||
Re: NavigatingI know this is old but I recently had the same problem and all you have to do it change the string
C-SHARP / C# Code:
C-SHARP / C# Code:
The problem I believe was that the program was looking for the string "http://" but when its looking for a blank spot it easily can insert it, I noticed it when I added "http://" to the URL and it added "http://" infront of the URL over and over. |
|
#3
|
|||
|
|||
Re: NavigatingQuote:
Huh??? Isn't the logic in the original post exactly backwards? See footnote. If it starts with the http stuff, just use it, otherwise prepend the http stuff. Maybe something like CPP / C++ / C Code:
Or, with a little more elegance, to my eye, and with an intent that is at least as clear (to me, that is): CPP / C++ / C Code:
Regards, Dave Footnote: Since I don't do .net, I can't test it, but assuming the original syntax was correct, isn't this what you had in mind? |
|
#4
|
|||
|
|||
Re: NavigatingHmm not really, that produces errors, and we are talking about C# if you read, but anyways no the code your "provided" does not work and produces even more errors.
And no its not what I had in mind. |
|
#5
|
||||
|
||||
Re: NavigatingQuote:
Quote:
.StartsWith("") will return true for any String, even the empty String. Your else condition will never be reached, and you always hit the if branch. Dave offered a good solution for a sane input. If the problem you are trying so solve is different, perhaps you can describe it, but providing a sample input and the expected output. Your current solution is logically flawed. Best regards, Lucian __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#6
|
|||
|
|||
Re: NavigatingI did say it does cause other problems there I pretty much did say it was flawed in a sense, and I know it is flawed but it makes the program run and it half works okay and that's what matters here at the moment okay?
Please read whole posts and whole threads before posting comments. P.S Dave did input something but that something is also flawed and doesn't even get the program to run. |
|
#7
|
||||
|
||||
Re: NavigatingQuote:
If you say so. My point is that C-SHARP / C# Code:
is equivalent to C-SHARP / C# Code:
So there is no need for an "if" branch at all. The code simply performs those 3 lines of code. Quote:
I always do. Quote:
Your program, perhaps. We didn't see it, you only made a suggestion to change a line of code. I can't believe I am spending my 1000th post arguing semantics. Have it your way - if you are happy with it, good for you. But I am not going to let this thread end with your mistaken suggestion. __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#8
|
|||
|
|||
Re: Navigating....Wow so you think everybody has to be perfect?
Okay fix it yourself mister "But I am not going to let this thread end with your mistaken suggestion." Oh by the way about you saying you always read all the posts that's utter bullcrap because you would have read that I said "the only problem now is if you press the button more than once it adds to many "http://" which isn't a big of a problem but it works" Go wank you bloody Romanian and correct I made a suggestion unlike you, you made no suggestion except for trying to correct me when there is nothing to correct I said it was flawed okay damnit. |
|
#9
|
||||
|
||||
Re: NavigatingQuote:
I believe we have a communication problem - me trying to help and you taking the defensive stance. The fact that the code is flawed is not an offense, as you seem to believe. Your last post however, is. Please refrain from this language in the future. Do you understand that using "StartsWith" with an empty string as a parameter makes no sense? Do you disagree with my assessment that removing the "if" statement and the else branch results in the same behavior? If yes, is there a point to them being in the code? Quote:
I did read that. And I told you why it happens. __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein Last edited by LuciWiz : 15-Jan-2009 at 16:58.
|
|
#10
|
||||
|
||||
Re: NavigatingI created a program with a WebBrowser object named "webBrowser1", a button called "button6" which will perform the code posted by Dave for OnClick and a TextBox "textBox1" where I input the name of the site.
So the code I used was exactly: C-SHARP / C# Code:
When introducing in the text box "www.gidforums.com" and pressing the button, the code added "http://" to the name of the site (making it "http://www.gidforums.com") and the page loaded (after I confirmed to my Firewall it's OK Introducing in the text box "http://www.gidforums.com" from the start resulted in the string remaining unchanged and the page loading again. Like I said, Dave's code is perfectly valid for what I consider sane input - a well formed site name. Obviously the function can be tricked by entering gibberish in the text box, but the code does its intended business. Quote:
Negating the condition in the "if" was indeed all that was needed, as stated. Quote:
There were no more suggestions to be made. Dave already solved the OP's problem. Regards, Lucian __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The