Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:05:20+00:00 2026-05-26T23:05:20+00:00

I am using DevExpress in my winform application, I have a gridview, data entry

  • 0

I am using DevExpress in my winform application, I have a gridview, data entry form, datanavigator, all bound to dataset.

I want to add new record, if using datanavigator “Add” it works good, how to do the same using a “New Record” button?

BindingSource.AddNew() 

is not working, it usually does, but with devexpress its not working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:05:20+00:00Added an answer on May 26, 2026 at 11:05 pm

    If you want to use binding then use your objects with binding source..

    and use the binding list .AddingNew += new AddingNewEventHandler(listOfParts_AddingNew);
    event to add new entity object ..

    See the example of BindingList on MSDN.

    void listOfParts_AddingNew(object sender, AddingNewEventArgs e)
            {
                e.NewObject = new Part(textBox1.Text, int.Parse(textBox2.Text));
    
            }
    

    DevExpress WinForm Controls works so fast with binding sources as compare to typed datasources etc… YOu can implement bindingSources using these example..

    set gridview and the associcated controls datasource to bindsouce that you have created…
    process your form with the this MSDN example..

    have a look on this code snippet.. may be you will get some idea from this..

    private void BindingLIstDemo_Load(object sender, EventArgs e)
            {
                InitializeListOfEmployees();
                BindlstEmp();
                listofEmp.AddingNew += new AddingNewEventHandler(listOfEmp_AddingNew);
                listofEmp.ListChanged += new ListChangedEventHandler(listofEmp_ListChanged);
    
            }
    
            private void BindlstEmp()
            {
                lstEmpList.Items.Clear();
                lstEmpList.DataSource = listofEmp;
                lstEmpList.DisplayMember = "Name";
    
            }
    
            void listofEmp_ListChanged(object sender, ListChangedEventArgs e)
            {
                MessageBox.Show(e.ListChangedType.ToString());
                    //throw new NotImplementedException();
            }
    
            //declare list of employees
            BindingList<Emp> listofEmp;
            private void InitializeListOfEmployees()
            {
    
                //throw new NotImplementedException();
                // Create the new BindingList of Employees.
                listofEmp = new BindingList<Emp>();
    
                // Allow new Employee to be added, but not removed once committed.
                listofEmp.AllowNew = true;
                listofEmp.AllowRemove = true;
    
                // Raise ListChanged events when new Employees are added.
                listofEmp.RaiseListChangedEvents = true;
    
                // Do not allow Employee to be edited.
                listofEmp.AllowEdit = false;
    
                listofEmp.Add(new Emp(1, "Niranjan", 10000));
                listofEmp .Add (new Emp (2,"Jai", 8000));
    
              }
    
    
            // Create a new Employee from the text in the two text boxes.
            void listOfEmp_AddingNew(object sender, AddingNewEventArgs e)
            {
                e.NewObject = new Emp (Convert.ToInt32(txtId.Text), txtName.Text,Convert.ToInt32(txtSalary.Text));
    
            }
    
            private void btnAdd_Click(object sender, EventArgs e)
            {
                Emp empItem = listofEmp.AddNew();
                txtId.Text = txtName.Text = txtSalary.Text = "";
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                Form1 obj = new Form1();
                obj.Show();
            }
    
            private void btnDelete_Click(object sender, EventArgs e)
            {
                var sg = (from sc in listofEmp.ToList<Emp>() where sc.Name == ((Emp)lstEmpList.SelectedValue).Name select sc);
    
    
    
    
    
            }
    
            private void lstEmpList_SelectedIndexChanged(object sender, EventArgs e)
            {
                Emp se = listofEmp[lstEmpList.SelectedIndex];
                txtId.Text = se.Id.ToString();
                txtName.Text = se.Name;
                txtSalary.Text = se.Salary.ToString();
    
            }
    

    Here I am using BindingList as datasouce BindingList<Emp> listofEmp; and on the place of grid listing of records are shown in a listbox control.. but all same…try this with your gridview..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using devexpress TextEdit in c#.net application and i want to implement auto
I am using DevExpress in my Winform project, and in my form there are
I am using DevExpress XtraGrid in c#.NET application. I want to disable or set
Hi all, I'm using DevExpress XtraGrid control in a C#.Net application. I'mbinding the values
I have a winform project that is using a devexpress layout control and I
i am using devexpress gridview 9.2. i have 2 gridview having 2 colum -->
I have build application using .NET 4.0, WinForms and DevExpress Winforms components. I have
I have a Delphi application using DevExpress cxGrid (which is connected to database). I
hii, I am using devexpress xtrascheduler.In this i have created one custom form which
I have created a web application using Devexpress trial version. I have installed the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.