Im trying to make a program which will allow you to type in some information (kind of like Google Autofill) and then you can click a button, and it automaticaly fills in the data you added to the fields on the website. Im not really good at C#, took a class in school which was for a few months. I guess i would need a way to search the field name and store it in a variable or something. then it would be something like: if((name == "Your Name") || (name == "Full Name")) { // Guess i would need to know how to add text to a field on the website also FieldName.Text = "Joe"; } Code (markup):
It's not very clear what your problem is. I guess your going to store data in a database or xml file and read this everytime a new webpage is loaded. You could do the Page_Load function where you could connect to a database and read the data depending on the webpage visited. You could then fill in the field information for that specific webpage. You may need to use some of web browser component like in VB for accessing the webpage content, this way you could iterate through all fields within the form. Hope this helps. Regards, Ben
You may want to look into something called AJAX. This allows asynchronous calls to your server without realoading the page. This is how google autofills quickly without refreshing the page or having all the data loaded to the client before hand, which would be way too much. It involves making some server side methods to return the value that you want, and converting it to some XML DOM compatible format (JSON Parser is good for this), and then some intermediate javascript to handle the asynch call back and populate your field with javascript. Hopefully this doesn't sound too complicated, but even if it does, if you do a search on AJAX you will find some free components (especially for .NET and C#) and some examples. Once you get the concept it's pretty slick...
where can i find the components for C#? (using Visual Studio .NET) I searched google and couldnt find anything about using AJAX on Visual Studio .Net If there is no way to use AJAX on Visual Studio .Net, what should i get that i can use AJAX on?
You won't find it in the VS 2003 MSDN. You will have to use an external component or build a simple version of your own. Here is a link to the one that I use in one of my projects: http://www.ajaxpro.info/ If you search Google for 'Ajax .NET example' you will find plenty. In it's simplest form, you basically use javascript to make a call to a specific web page that you have with some parameters. You have that web page return only the text that is the answer(s) to you call, no headers or anything. You then use the return text and parse it out and populate your form with javascript. It can get more complicated from there, but do some searches on AJAX and examples. Like I said, it might look complicated at first but it is something well worth learning. It will change the way you thinking about building dynamic we apps. -Darrin
I dont get it, what can i do with the files i downloaded from there? And what is this .NET your talking about? And im running Visual Studio 2005 .Net (not 2003)
I'm sorry, I might be confusing you by suggesting this more than helping. AJAX is not something that is specific to Visual Studio. That's why I say not to look in the documentation for Visual Studio, which I thought you had eluded to earlier. The reason I said to look for .NET in your searches was suggesting that you might want to find an example of using AJAX with a .NET example specifically, instead of just a general example. Here is a nice article about it: http://dev2dev.bea.com/pub/a/2005/08/ajax_introduction.html If you are still confused after this I would suggest not pursuing this type of solution.
You can just use the example in the URL in my previous post. It is not anything you have to buy or download.
I don't quite know if AJAX is what you're after: that just does (non-GUI) communication between client and server without page reloads. From what I understand, you want a client side application to autopopulate fields in a web page, which really has nothing to do with AJAX at all. Firstly, are you trying to write a standalone application, or a browser extension? If you're writing a standalone app, I would suggest that the easiest thing to do would be to download the code for Keepass and see how they do it. It's not really that hard, but a lot of funky Windows code, to be honest. In reality, it would probably be easier to just grab the Keepass code and hack that to add any functionality that was missing. Assuming you aren't planning on writing an application that doesn't follow the source licence! If you want to write a browser extension, then I don't know.
What you could do is use the WebBrowser control and find a field you would like to be filled in and then fill that field in with a press of a button. Here is some sample code when I was working on my Myspace Train Submitter program. It uses the WebBrowser Control and MSHTML. mshtml.IHTMLDocument2 Doc = IEBrowser.Document; mshtml.HTMLInputElement MyspaceName = Doc.all.item("input_id", 0); mshtml.HTMLInputElement MyspaceText = Doc.all.item("input_quote", 0); mshtml.HTMLInputElement Submit = Doc.all.item("submit", 0); MyspaceName.value = ""; MyspaceName.value is a string value so anything that is a string could be used as the value of the form field. Example would be - MyspaceName.value = "Form Input Value"; Hope this helps. Let me know if you have any questions.