|
ThisIsMyUserName2 wrote: It happens all the time on the site I'm trying to interact with and it occasionally happens on google.com (or any site I'd imagine).
ThisIsMyUserName2 wrote: Any ideas?
They hide that information in the DOCUMENTATION[^]
Remarks
The value of the URL parameter might not match the URL that was originally given to the WebBrowser Control. One possible reason for this is that the URL might be converted to a qualified form. For example, if an application specified a URL of www.microsoft.com in a call to the Navigate or Navigate2 method, then the URL passed into DocumentComplete is http://www.microsoft.com/. In addition, if the server has redirected the browser to a different URL, the redirected URL is passed into the URL parameter.
The WebBrowser Control fires the DocumentComplete event when the document has completely loaded and the READYSTATE property has changed to READYSTATE_COMPLETE. Here are some important points regarding the firing of this event.
* In pages with no frames, this event fires once after loading is complete.
* In pages where multiple frames are loaded, this event fires for each frame where the DownloadBegin event has fired.
* This event's pDisp parameter is the same as the IDispatch interface pointer of the frame in which this event fires.
* In the loading process, the highest level frame (which is not necessarily the top-level frame) fires the final DocumentComplete event. At this time, the pDisp parameter will be the same as the IDispatch interface pointer of the highest level frame.
led mike
|
|
|
|
|
Hmm, what can I do to get what I'm looking to do working (only having it trigger once)? It still happens on the DocumentTitleChanged event, I'm out of ideas on determining which URL is currently being navigated.
Here are the cases I look for and the actions that take place depending on which step (URL) I'm on.
At a login screen
-- automatically login
-- goto the search screen
At a search screen
-- search for xx (a number that the user of the app enters which gets auto-incremented)
-- determine if the search returned a result
---- if it did, then move on to the "scrape phase"
---- if it did NOT, go back to the search screen and log it
-- auto increment (here's the part where having it load twice is killing me)
At the Scrape phase (which is the same URL as the search screen except it has a "#search_result" in the URL)
-- Parse out 2 URLs from the search result and navigate to the first address
At first URL result
-- Check for xx (which is entered in my app but will be a constant in the session)
---- if it found it, move onto the second URL
---- if it did NOT find it, go back to the search page
At second URL result
-- Scrape a few pieces of information and store it into a DataSet
-- Go back to the search page and start over
I can't use the WebClient class because it requires slight user interaction due to a random character generator (on their site) coming up on various steps of the procedure. To counter that I check the page source for a specific string that only exists when this page is shown and I perform this check before I run the switch.
|
|
|
|
|
ThisIsMyUserName2 wrote: what can I do to get what I'm looking to do working
Well since you have not stated "what I'm looking to do", I have no idea.
led mike
|
|
|
|
|
Something that would do exactly what DocumentCompleted/DocumentTitleChanged does except only fire once.
ie. Have the ability to figure out which URL is being navigated after a page is loaded and do something based on what URL that is.
|
|
|
|
|
Since you have zero control over the firing of events, I'll refer you to the red text[^] again. You can try counting the number of times the DownloadBegin event fires, incrementing a counter by 1. When the DocumentComplete event fires, decrement that counter. When you reach 0, the page should be done. You might want to double-check with the READYSTATE to see what it says too.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I don't think the Web Browser control has a DownloadBegin event. Remember I am using the Web Browser included with .net 2.0 in c#.
As for the readystate, I tried "if the readystate is Complete then do the switch...", and it still ran it twice.
Also as far as I can see the site is not using frames. At least not frames in a standard sense. They might be using javascript to insert "layers" into the page though.
|
|
|
|
|
Hi:
I have a windows Form in C#. In my project I have multiple namespace1 & namespace2 and 1 Form.
On the Form I have a Button, when clicking this button I need to call-out to namspace2. Is it possible to do this. Please Help.
THanks,
Eyungwah
|
|
|
|
|
Eyungwah wrote: Is it possible to do this.
using Eyungwah.GetAClue
led mike
|
|
|
|
|
You can't call a namespace. Namespaces contain things like classes, interfaces, enums and so on.
If you are in namespace A and you want to use a class in namespace B you have two options.
Option 1: Put a using statement at the top of the file in which you wish to use the namespace. e.g. using B
Option 2: Fully qualify the class, interface, enum, etc. name with the namespace. e.g. B.MyClass
|
|
|
|
|
hi,
can anyone tell me
what is the advantage of xml in small data storage?
why not use access or excel file?
and how can I use xml in desktop application beside that?
thanx
|
|
|
|
|
I prefer XML because it's quite flexible, its output carries a small footprint and works very well with the DataSet class.
Example:
I wrote a small app that gathers data daily from a web site. Usually about 200 things.
I just have it record the information straight into a DataSet, then use the DataSet's built in SaveToXML ability. If I need to open that list at a later time, the DataSet can read the XML file without any extra work.
Also if I decide to send the results to someone I can be sure they'll be able to open it, rather than have to set them up with access, excel, or a custom app that displays the contents within a DataGrid or whatever.
Lastly if I ever decided to publish the results online it wouldn't take much effort to get them into an SQL database.
|
|
|
|
|
maybe when you combine your app with web app
xml as it's adventages
but for desktop app i don't see its better then
access db
am i right?
|
|
|
|
|
The main arguments the other poster mentioned do not depend upon the fact whether your application is a web or windows application. A XML file simply can be read with the simplest text editor, most systems provide some way to display them in a nice way (via browser for example )and there are many ways for further processing of the XML data for example via XSLT or import into other applications. In that way it has its advantages no matter what type of application you use it in.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
i have to make an application that will simply have one form and one DataGrid control on the Form. i have to query from oracle database based on some criteria entered by the user. DataBase can consist of 100 Tera Bytes of data that is why i want to use paging. i tried to find some sample code/artical that will tell me how to do paging in C#. Every one is doing paing with some tricky select command using in clause for omitting the results that user don't want to see. In case of small data this select technique will work fine but in case of large data will it not be very slow. so my question is, Is there any other way to do paging.
Thanks & Regards,
Omar Lodhi
|
|
|
|
|
Hello,
Though I'm relatively new to C# development, (I mean REALLY new, so please go easy on me... lot's of descriptions) I'm always willing to try examples, and play around. I have somewhat of a background of C, so as long as there is descriptions of what everything does, the syntax wont scare me. I would like to create a tiny program that cleans the Windows XP Registry of all keys with the word "SQL", for the company I work for. If any of you have ever tried to delete SQL Server, you'll know what a giant pain it is. So, we've found, after running all the SQL uninstallers, if we wipe the registry of everything SQL... re-installing it is a breeze! Hence my program. Is there some type of code that I can play with that will scan the registry for everything with the word "SQL", and then, give you the option to delete everything? I think by automating this process like this, it will make it easier for our clients to re-install SQL Server.
Your help is much appreciated guys, and will probably help me strengthen my programming skills with C#.
|
|
|
|
|
The classes you'll be interested in is Microsoft.Win32.Registry and Microsoft.Win32.RegistryKey . Those classes have methods on them for retrieving different keys, subkeys, and values in the registry.
You can compare strings by using the various methods on the System.String class:
string someKey = "helloSql!";
if(someKey.Contains("Sql"))
{
...
}
You can also do some culture-specific and case-specific string operations:
int indexOfSqlInString = someKey.IndexOf("SQL", StringComparison.InvariantCultureIgnoreCase);
if(indexOfSqlInString != -1)
{
...
}
If you're really brave, you can try out regular expressions found in System.Text.RegularExpressions .
|
|
|
|
|
td00 wrote: Is there some type of code that I can play with that will scan the registry
I am not aware of any searching Registry API[^]. Therefore you would have to walk (enumerate) the registry get the strings and perform your comparisons.
led mike
|
|
|
|
|
Hi, I'm trying to write a basic windows game, at the moment all I want to do is load in a background image (i've created as a jpg.) and then I want to create a sprite and move this around my screen. Pretty basic I suppose especially for you c# guru's out there, however i'm getting an error when compiling and running my program so far. I've just instructed it to load in my background and i'm getting the following:
Resource 'background.jpg' cannot be found in class 'Game.Form1'.
Here is all my code so far for my program:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data;
namespace Game
{
public partial class Form1 : Form
{
// insert private bitmap background
// and bitmaps references to main sprite
// and movement int x/y move etc.....
private Bitmap background = new Bitmap(640, 320);
private Bitmap car;
private Bitmap player;
public Form1()
{
InitializeComponent();
//player = new Bitmap(GetType(), "player.jpg");
//car = new Bitmap(GetType(), "car.jpg");
Bitmap background = new Bitmap(GetType(), "background.jpg");
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
Graphics g = Graphics.FromImage(background);
for (int x = 0; x < 640; x += 90)
for (int y = 0; y <= 290; y += 90)
{
g.DrawImage(background, new Rectangle(x, y, 90, 90)); // GraphicsUnit.Pixel);
}
}
}
}
Many thanks if anyone can help me
|
|
|
|
|
lee.hallows wrote: New Programmer Help Please!
This subject line does not convey any useful information.
Pretty much everyone who posts a new thread here is looking for help. And the fact that you are a new programmer is not as relevant as other details.
Please see rule three of the posting guides.
|
|
|
|
|
Thanks for ALL your help, NOT. Whats wrong with the subject heading?
I only posted this because I thought i'd get a quick answer as it isn't the most complex thing i'm trying to write but i've hit a problem due to being a beginner. If this is the so called help you get on here I won't bother.
|
|
|
|
|
lee.hallows wrote: Whats wrong with the subject heading?
It contains nothing of your actual problem.
The fact that you are a "new programmer" doesn't mean anything. There are many experienced programmers just migrating to the .NET Framework that might have the same problems as you.
Also, "Help Please!" is redundant. Everyone here is looking for help.
A subject line of "Bitmap problem", "Resource problem" or "Loading Bitmap from Resource problem" would have been better and fit with the posting guidelines.
|
|
|
|
|
lee.hallows wrote: Whats wrong with the subject heading?
For one it indicates you CAN'T READ. How to get an answer to your question[^]
3. Keep the subject line brief, but descriptive. eg "File Serialization problem"
If people don't think you can read why would they bother posting a reply that you would have to READ?
Would you like to ask any more questions?
led mike
|
|
|
|
|
PlayByTheRules wrote: This subject line does not convey any useful information.
Sure it does, I'm not a "New Programmer" so I guess I can't help him.
led mike
|
|
|
|
|
lee.hallows wrote: i'm getting an error when compiling and running my program
The error you gave is a runtime error. The compilation was successful. It also helps if you give an indication of where the error occurred. I'm guessing it is this line:
Bitmap background = new Bitmap(GetType(), "background.jpg");
lee.hallows wrote: Resource 'background.jpg' cannot be found in class 'Game.Form1'.
Have you added the "background.jpg" file as a resource? Are you sure you have used the correct name? If you think you have you might want to download Lutz Roeder's Reflector and examine the assembly.
|
|
|
|
|
If you added the image/bitmap to your project resource file,
and for instans you rename it to "myBackground"
you should be able to access it like this:
Bitmap bm = Properties.Resources.myBackground;
|
|
|
|