I am using a webbrowser control in my form program and i am displaying an html page. There is 1 textbox in html page and id is "textbox". When someone write something in textbox, i want to use this text and save it to db. It will be work like this; somebody is writing somethings in textbox(in html page) and when press the button(form button), i want to save this text.
How can i do that?
3
Contributors
5
Replies
1 Day
Discussion Span
3 Years Ago
Last Updated
7
Views
Question Answered
Related Article:WPF WebBrowser Control
is a C# discussion thread by nccsbim071 that has 4 replies, was last updated 3 years ago and has been tagged with the keywords: c#, form, php, post, webbrowser, wpf.
The textbox is in html page. There is a webbrowser control and it has a textbox(in html page) and then in form, there is a button. When a user write "example" in textbox(in html page), and then click the button, I want to catch this "example".
string txt = ...................; ----> txt must be what user write in textbox.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
namespace GetTextInTextBox
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnGetText_Click(object sender, EventArgs e)
{
MessageBox.Show(webBrowser1.Document.GetElementById("textbox").GetAttribute("value"));
}
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Url = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "pageWithTextBox.htm"));
}
}
}