Click here to Skip to main content
15,892,643 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to Refresh the grid from Form2 Pin
Erdinc273-Jan-10 23:05
Erdinc273-Jan-10 23:05 
GeneralRe: how to Refresh the grid from Form2 Pin
sanforjackass3-Jan-10 23:23
sanforjackass3-Jan-10 23:23 
GeneralRe: how to Refresh the grid from Form2 Pin
Erdinc273-Jan-10 23:37
Erdinc273-Jan-10 23:37 
GeneralRe: how to Refresh the grid from Form2 Pin
sanforjackass3-Jan-10 23:47
sanforjackass3-Jan-10 23:47 
GeneralRe: how to Refresh the grid from Form2 Pin
OriginalGriff3-Jan-10 23:34
mveOriginalGriff3-Jan-10 23:34 
AnswerRe: how to Refresh the grid from Form2 Pin
Alex Manolescu3-Jan-10 23:52
Alex Manolescu3-Jan-10 23:52 
GeneralRe: how to Refresh the grid from Form2 Pin
Erdinc274-Jan-10 0:26
Erdinc274-Jan-10 0:26 
AnswerRe: how to Refresh the grid from Form2 Pin
Alex Manolescu4-Jan-10 9:46
Alex Manolescu4-Jan-10 9:46 
hi,
I've made a small project for you.
Supose you have a DataGridView control with 1 column.
The value we need to pass to the AddRow method is the string info.

Form1:
- contains: a DataGridView and a Button

public partial class Form1 : Form
    {
        // delegate definition
        public delegate void InsertIntoDGV(string info); 
        public static InsertIntoDGV idv; 
        
        public Form1()
        {
            InitializeComponent();
            idv = new InsertIntoDGV(AddRow); // the method we will call is AddRow
        }

        // this method we use for inserting string info into the DataGridView
        public void AddRow(string info)
        {
            dataGridView1.Rows.Add(new object[] { info });
        }

        // button for Form2
        private void button1_Click(object sender, EventArgs e)
        {
            new Form2().ShowDialog(); 
        }
    }


And now Form2:
- contains a TextBox and a Button.

public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

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


Hope this helps!

Cheer's,
Alex Manolescu.
GeneralRe: how to Refresh the grid from Form2 Pin
Alex Manolescu5-Jan-10 23:58
Alex Manolescu5-Jan-10 23:58 
QuestionAn unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
Qasim19843-Jan-10 22:09
professionalQasim19843-Jan-10 22:09 
AnswerRe: An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
SeMartens3-Jan-10 22:19
SeMartens3-Jan-10 22:19 
GeneralRe: An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
Qasim19843-Jan-10 22:22
professionalQasim19843-Jan-10 22:22 
GeneralRe: An unhandled exception of type 'System.StackOverflowException' occurred in MyProject.web.DLL Pin
SeMartens3-Jan-10 22:31
SeMartens3-Jan-10 22:31 
QuestionSQL and C# [modified] Pin
jojoba20103-Jan-10 22:04
jojoba20103-Jan-10 22:04 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 22:10
professional dan!sh 3-Jan-10 22:10 
GeneralRe: SQL and C# Pin
jojoba20103-Jan-10 22:13
jojoba20103-Jan-10 22:13 
GeneralRe: SQL and C# Pin
dan!sh 3-Jan-10 22:16
professional dan!sh 3-Jan-10 22:16 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 22:19
jojoba20103-Jan-10 22:19 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 22:23
professional dan!sh 3-Jan-10 22:23 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 22:25
jojoba20103-Jan-10 22:25 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 22:47
professional dan!sh 3-Jan-10 22:47 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 22:57
jojoba20103-Jan-10 22:57 
AnswerRe: SQL and C# Pin
dan!sh 3-Jan-10 23:05
professional dan!sh 3-Jan-10 23:05 
QuestionRe: SQL and C# Pin
jojoba20103-Jan-10 23:09
jojoba20103-Jan-10 23:09 
AnswerRe: SQL and C# Pin
Not Active4-Jan-10 1:16
mentorNot Active4-Jan-10 1:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.