I have a program where am trying to access a dataset in the main form from a 2nd Winfrom. I have created a form 1 ref but when I use this to access the datatable in the dataset it doesnt seem to work. The following code is for Form 2 and I Movset1 is the dataset in the main form. I then try to use a dataview to access the main dataset. Any help would be appreciated.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.Common;

namespace MovieDiary
{
    public partial class Form2 : Form
    {


        DataView Dv2 = new DataView();
        public Form2()
        {
            
            InitializeComponent();
            
        }

        public Form1 F1 = new Form1();
        

        public void Form2_Load(object sender, System.EventArgs e)
        {
           
        }
        

         
         
        
        
        
        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show(" Please enter a title to be deleted ");
                return;
                   
                
            }


            Dv2 = new DataView(F1.Movset1.Tables[0]);
            F1.dataGrid1.DataSource = Dv2;
            Dv2.RowFilter = "Title ='" + textBox1.Text + "'";
           
            
           
            
           
        }
    }
}

Last edited by shabbir; 10Jun2012 at 17:32.. Reason: Code blocks