Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi friends
I am working on a small windows application, it is like a web browser applicaion, i can read website (fore instance "www.facebook.com) in application,
 
now i want to put text from my text boxes to the website's text boxes. plx help
 
i am going to upload a sample application which explains , kindly update it if any one can do it. (facebook is just an example website..)
 
download VS project file to edit
 
view desired output
Posted 2-Jan-13 9:14am
Edited 2-Jan-13 9:16am
v2
Comments
DinoRondelly at 2-Jan-13 15:18pm
   
Where are you stuck?
Have you tried google?
www.google.com
Member 8973214 at 2-Jan-13 15:24pm
   
here i have just read the page,
now i want to put text from textbox (created by me) to facebook textboxes. as shown in the desired output image..
Zoltán Zörgő at 2-Jan-13 15:20pm
   
I understood what you asked for, but I would like to know why? There are ways to automate a browser, or to embed a browser control in your application. But in many cases there is no need to, it is probably, that you should only simulate the http level behavior of the browser.
Member 8973214 at 2-Jan-13 15:30pm
   
I dont know much about webbrowser class and http classes dear.
I just want to do this like automate ( like to save time). facebook is just example here, and i dont want to do this for any misuse etc.
if you can tell me any other website which fulfills this technique then it is also fine for me.
Sergey Alexandrovich Kryukov at 2-Jan-13 15:32pm
   
To my understanding, OP is already embedding an instance of the control WebBrowser...
@Member 8973214: is that so?
—SA
Zoltán Zörgő at 2-Jan-13 15:35pm
   
I suppose so, but could be a better approach out there...
Member 8973214 at 2-Jan-13 15:52pm
   
@Zoltan; cant you help me for this? it is just class assignment, i am student of IT.
Member 8973214 at 2-Jan-13 15:39pm
   
@sergey: i am really not sure what is OP?
I just used webbrowser tool and navigate to read the file like this..
webBrowser1.Navigate(new Uri("http://www.facebook.com"));
Sergey Alexandrovich Kryukov at 2-Jan-13 15:50pm
   
Oh, sorry for the use of this stupid abbreviation, it's just because too many members use it. I believe it means "Original Poster" or something like that. In this case, this is you. :-)
—SA
Sergey Alexandrovich Kryukov at 2-Jan-13 15:51pm
   
Solution 1 looks like a right thing to do, did you try it out?
—SA
Member 8973214 at 2-Jan-13 16:04pm
   
@surgey; oh okay daer,:-) i think its my first time that i asked a question here. yes i tried the solution it works fine. (id can be taken from the html of the page is it?)
Sergey Alexandrovich Kryukov at 2-Jan-13 16:10pm
   
Great. Thank you for your confirmation as now I can up-vote this answer, as the author of it deserves it; the solution is correct and practically sensible. I suggest you do the same.
—SA
Member 8973214 at 2-Jan-13 16:16pm
   
yes 100% perfect solution by HashamAhmad..
Member 8973214 at 2-Jan-13 16:14pm
   
Thank you HashamAhmad , Zoltan Zorgo and all for the help.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

consider you have your textbox name txtlogin, your webbrowser control name webBrowser1 and the website have the textbox have the name txtEmailAddress
you use the following code
 
webBrowser1.Document.GetElementById("txtEmailAddress").SetAttribute("value", txtlogin.Text);
To use the above code, you will be required to handle the DocumentCompleted event of webbrowser control
  Permalink  
Comments
Member 8973214 at 2-Jan-13 16:07pm
   
Hasham thanks for simple solution. I am Adil.:)
Sergey Alexandrovich Kryukov at 2-Jan-13 16:11pm
   
I voted 5 for this correct solution, advised OP to do the same.
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

It really depend on the complexity of the automation. Putting something on a webpage makes no sense, you either send something to the server, or just draw on an image Smile | :) . Well, the exact assignment specification could be interesting...
 
But you have several approaches, some articles and samples to read:
1) Use WebBrowser control, see:
http://www.codeproject.com/Articles/5452/Microsoft-Web-Browser-Automation-using-C
http://www.codeproject.com/Articles/18935/The-most-complete-C-Webbrowser-wrapper-control
2) Automate the Internet Explorer itself:
http://harness.codeplex.com/.
If you have not been told to use WebBrowser control, use this one!
3) If you don't need to have a browser at all, use WebClient, see:
http://www.dotnetperls.com/webclient
http://technet.rapaport.com/Info/LotUpload/SampleCode/Full_Example.aspx
 
But first of all, you should get to know the http protocol. It is a complex one, but the Wikipedia article is a really good starting point.
  Permalink  
Comments
Member 8973214 at 2-Jan-13 16:08pm
   
thanks alot Zoltan, for more references these will help me.:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 886
1 OriginalGriff 390
2 CPallini 255
3 Volynsky Alex 205
4 Richard Deeming 175
0 OriginalGriff 5,540
1 Sergey Alexandrovich Kryukov 4,668
2 CPallini 4,540
3 George Jonsson 3,102
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100