TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
amr
NA
46
6.1k
my data grid view dosent updated
Jul 18 2012 5:30 AM
i have 2 forms one of them is my main form where my datagridview is,and the second form where my textbox is ,and i need to make any input on the textbox shows in my datagridview but it didnot appear
here is my form1 code
namespace datatabl
{
public partial class Form1 : Form
{
DataTable customers =new DataTable();
public Form1()
{
InitializeComponent();
create();
dataGridView1.DataSource = customers;
}
private void create()
{
customers.Columns.Add("FirstName", typeof(string));
customers.Columns.Add("LastName", typeof(string));
}
public void addrows(string firstname,string lastname)
{
customers.Rows.Add(firstname, lastname);
}
private void newToolStripButton_Click(object sender, EventArgs e)
{
Form2 d = new Form2();
d.Show();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
and my second form code is
namespace datatabl
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
f.addrows(textBox1.Text, textBox2.Text);
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}
Reply
Answers (
4
)
How to disable Browser Back button in asp.net application
How to use Progressbar with BackGroundWorker