how to add record programmatically to datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jaYPee

    how to add record programmatically to datagrid

    Anyone know how to add record to a datagrid programmaticall y?

    Say for example I have two textboxes in my form and a datagrid. When I
    click a button the value of two textboxes will be added as a new row
    to my datagrid.

    Thanks in advance.
  • chandan

    #2
    Re: how to add record programmaticall y to datagrid


    "jaYPee" <hijaypee@yahoo .com> wrote in message
    news:dmn2q05onk fn0d7vk1dobg5ps qfd2fbkcm@4ax.c om...[color=blue]
    > Anyone know how to add record to a datagrid programmaticall y?
    >
    > Say for example I have two textboxes in my form and a datagrid. When I
    > click a button the value of two textboxes will be added as a new row
    > to my datagrid.
    >
    > Thanks in advance.[/color]

    HI ,
    Its simple u just put it in DATASET
    and bind the data grid with the dataset
    Add the items in Dataset Datatable
    In data table add new row.


    Comment

    • jaYPee

      #3
      Re: how to add record programmaticall y to datagrid

      I have already tried this w/ dataset but the problem is it doesn't
      work w/ the grand child of my relationship

      I have ask this before but doesn't recieved any response. here's the
      question I made before.

      My problem now is on how can I solve the problem when adding
      a new record to my table.

      This is my source code that works perfectly if I set the table to
      "SchYrSemCourse Join"

      Dim dr As DataRow =
      DsStudentCourse 1.Tables("SchYr SemCourseJoin") .NewRow()
      dr("CourseID") = intcourse + 1

      DsStudentCourse 1.Tables("SchYr SemCourseJoin") .Rows.Add(dr)

      This code works perfectly if the datamember of my datagrid is set to
      "SchYrSemCourse Join". However because I am using a parent/child form
      so the actual datamember of my datagrid is
      "Students.Stude ntsSchYrSem.Sch YrSemSchYrSemCo urseJoin" and the
      datasource is "DsStudentCours e1"

      My purpose with this code is to add a new row to a datagrid.



      On Mon, 22 Nov 2004 11:20:50 +0530, "chandan" <chandan@sys.co m> wrote:
      [color=blue]
      >
      >"jaYPee" <hijaypee@yahoo .com> wrote in message
      >news:dmn2q05on kfn0d7vk1dobg5p sqfd2fbkcm@4ax. com...[color=green]
      >> Anyone know how to add record to a datagrid programmaticall y?
      >>
      >> Say for example I have two textboxes in my form and a datagrid. When I
      >> click a button the value of two textboxes will be added as a new row
      >> to my datagrid.
      >>
      >> Thanks in advance.[/color]
      >
      >HI ,
      >Its simple u just put it in DATASET
      >and bind the data grid with the dataset
      >Add the items in Dataset Datatable
      >In data table add new row.
      >[/color]

      Comment

      Working...