0
Reply

How to Fill a lot Texboxes on Webbrowser with a button

Cevdet Adanali

Cevdet Adanali

Feb 23 2013 9:48 AM
1.3k
Hi,

I have a windows form in csharp with a datagridwiev and webbrowser.I can take 3 columns from Excel in Datagirdwiev.I wanna filling texboxes on webpage with data from only a column in Datagridwiev with a button.On webpage we can move cursor with TAB.

Can anybody help me??

 Thanks...


Here is Codes :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace Import_Excel_file_into_DataGridView
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnBrowse_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
DialogResult dlgResult = dlg.ShowDialog();
if (dlgResult == DialogResult.OK)
{
txtPath.Text = dlg.FileName;
}
}

private void btnLoadData_Click(object sender, EventArgs e)
{
if (System.IO.File.Exists(txtPath.Text))
{
string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;""", txtPath.Text);
string query = String.Format("select * from [{0}$]", "Sayfa1");
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connectionString);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
dataGridView1.DataSource = dataSet.Tables[0];
}
else
{
MessageBox.Show("No File is Selected");
}
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(textBox1.Text);
}

private void button2_Click(object sender, EventArgs e)
{
webBrowser1.GoBack();
}

private void button3_Click(object sender, EventArgs e)
{
webBrowser1.GoForward();
}

private void button4_Click(object sender, EventArgs e)
{
webBrowser1.Refresh();
}

private void button5_Click(object sender, EventArgs e)
{
this.webBrowser1.Focus();
SendKeys.Send("{TAB}");
SendKeys.Send("(+{TAB})");

}

private void button6_Click(object sender, EventArgs e)
{
this.Close();
}
}
}