okay so i have Form2 which has a db table named Car using LINQ with four attributes(Make, Model, Year, Price). Now Form1 has 4 textboxs using ReadLines to acquire the make,model,year,price). How do i get them to insert into the table on Form2. thanks in advance for the help.

Please post your code so we can help you figure out.

THIS IS FORM1, im sure it needs revision. i based my code so far on console applications. im not too familiar with windows forms

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;

namespace Project
{
    public partial class Form1 : Form
    {
        string make;
        string year;
        string model;
        string price;

        static int indx = 0;

        public static Car[] Catelog = new Car[100];

        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {

        }

  
        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string make = Console.ReadLine();

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            string model = Console.ReadLine();
        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            string year = Console.ReadLine();
        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {
            string price = Console.ReadLine();
        }

        public void button1_Click(object sender, EventArgs e)
        {
            make = (textBox1.Text);
            model = (textBox2.Text);
            year = (textBox3.Text);
            price = (textBox4.Text);
            //Add(year, make, model, Convert.ToInt32(price));
        }



        public static void Add(string year, string make, string model, double price)
        {

            Catelog[indx] = new Car(year, make, model, price);

            indx++;

        }







        public class Car
        {
            public string sortby;

            private string _make;

            private string _model;

            private double _price;

            private string _year;

            public Car(string Year, string Make, string Model, double Price)
            {



            }

            public string Make
            {

                get
                {

                    return _make;

                }

                set
                {

                    _make = value;

                }

            }

            public string Model
            {

                get
                {

                    return _model;

                }

                set
                {

                    _model = value;

                }

            }

            public double Price
            {

                get
                {

                    return _price;

                }

                set
                {

                    _price = value;

                }

            }

            public string Year
            {

                get
                {

                    return _year;

                }

                set
                {

                    _year = value;

                }

            }

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }


        }


    }


THIS IS FORM2 WITH THE DB

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;

namespace Project
{
    public partial class Form2 : Form
    {

        public Form2()
        {
            InitializeComponent();
        }

        private void carBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.carBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.database1DataSet);

        }

        private void Form2_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'database1DataSet.Car' table. You can move, or remove it, as needed.
            this.carTableAdapter.Fill(this.database1DataSet.Car);

        }

        private void carDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void fillByToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.carTableAdapter.FillBy(this.database1DataSet.Car);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }

        }

        private void carBindingSource1BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.carBindingSource1.EndEdit();
            this.tableAdapterManager1.UpdateAll(this.database1DataSet1);

        }

        private void Form2_Load_1(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'database1DataSet1.Car' table. You can move, or remove it, as needed.
            this.carTableAdapter1.Fill(this.database1DataSet1.Car);

        }

        private void carDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void fillByToolStripButton1_Click(object sender, EventArgs e)
        {
            try
            {
                this.carTableAdapter1.FillBy(this.database1DataSet1.Car);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }


        }
    }

please help. i also need to know how to delete the record from the table

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.