DataGridView DataBinding

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

    #1

    DataGridView DataBinding

    Hi all,

    I have a DataGridView control in my Windows Forms application. I am
    binding it to a DataTable in another assembly. The name of the assembly is
    ActivityListDAL C. I want to bind my grid to
    ActivityListDat aSet.ActivityLi stDataTable in this assembly. I selected this
    DataTable in the grid's Properties window and it added a component called
    ScheduledCallDa taTableBindingS ource to my form. I can also see the column
    names in my grid. But when I run the application, the grid displays no row.
    Do I need to do anything in the form's load event to make sure the grid gets
    populated?

    Thanks in advance.


  • Jeff

    #2
    Re: DataGridView DataBinding

    did you call the datagrid.bind() in your form load?

    Comment

    • helpful sql

      #3
      Re: DataGridView DataBinding

      Thanks. Is DataGrid different from DataGridView?
      I din't see DataGrid control in my VS2005 installation. So I used
      DataGridView and I don't see any Bind method in DataGridView.

      "Jeff" <justjeff@jeff. net> wrote in message
      news:igUWf.2037 5$uX5.6779@torn ado.texas.rr.co m...[color=blue]
      > did you call the datagrid.bind() in your form load?[/color]


      Comment

      • helpful sql

        #4
        Re: DataGridView DataBinding

        OK, I checked how many rows there are in ScheduledCallDa taTableBindingS ource
        component and it was empty. I had no rows. So my question is how to fill
        this component with data?

        "helpful sql" <nospam@stopspa m.com> wrote in message
        news:e93qhtBVGH A.4792@TK2MSFTN GP14.phx.gbl...[color=blue]
        > Hi all,
        >
        > I have a DataGridView control in my Windows Forms application. I am
        > binding it to a DataTable in another assembly. The name of the assembly is
        > ActivityListDAL C. I want to bind my grid to
        > ActivityListDat aSet.ActivityLi stDataTable in this assembly. I selected
        > this DataTable in the grid's Properties window and it added a component
        > called ScheduledCallDa taTableBindingS ource to my form. I can also see the
        > column names in my grid. But when I run the application, the grid displays
        > no row. Do I need to do anything in the form's load event to make sure the
        > grid gets populated?
        >
        > Thanks in advance.
        >[/color]


        Comment

        • Jeff

          #5
          Re: DataGridView DataBinding

          Well, now I'm all confused...I know there is a DataGrid control...and an
          ADO.NET DataView. But I don't know what a DataGridView is.

          Comment

          • helpful sql

            #6
            Re: DataGridView DataBinding

            So you have never used DataGridView? Are you using VS2005?

            "Jeff" <justjeff@jeff. net> wrote in message
            news:2LVWf.2096 8$uX5.2619@torn ado.texas.rr.co m...[color=blue]
            > Well, now I'm all confused...I know there is a DataGrid control...and an
            > ADO.NET DataView. But I don't know what a DataGridView is.[/color]


            Comment

            • Jeff

              #7
              Re: DataGridView DataBinding

              that would explain it... i'm trapped in 2003.NET

              Comment

              • Cor Ligthert [MVP]

                #8
                Re: DataGridView DataBinding

                Jeff,
                [color=blue]
                > that would explain it... i'm trapped in 2003.NET[/color]

                To make it even more confusing, you were in my idea answering an ASPNET
                datagrid.
                This is the best example of the not coordinated given names in version 2003.

                There are two DataGrids (still in version 2005 however not direct in the
                toolbox) one for WindowsForms and one for AspNet. Luckily is this as far as
                I have seen better done in version 2005.

                Just as addition,

                Cor


                Comment

                • Cor Ligthert [MVP]

                  #9
                  Re: DataGridView DataBinding

                  Helpful,
                  [color=blue]
                  > OK, I checked how many rows there are in
                  > ScheduledCallDa taTableBindingS ource component and it was empty. I had no
                  > rows. So my question is how to fill this component with data?
                  >[/color]
                  I think that this is not possible to answer in the way you ask this.
                  Do you have code in your DLL to do that,
                  Do you have code in your DLL that can be used to start that.

                  If you have a look at the standard Dataset/DataTable as it is generated by
                  the Designer, than you are already far in the right direction.

                  Just my idea.

                  Cor


                  Comment

                  • Jonte

                    #10
                    RE: DataGridView DataBinding

                    I use a xml-file and a datagridView like this to display it:
                    public partial class Form1 : Form
                    {
                    public Form1()
                    {
                    InitializeCompo nent();
                    string filePath = "IP.xml";
                    ipDataset.ReadX ml(filePath);
                    dataGridView1.D ataSource = ipDataset;
                    dataGridView1.D ataMember = "ip";
                    }

                    }
                    Thats all....
                    Jonte

                    "helpful sql" wrote:
                    [color=blue]
                    > Hi all,
                    >
                    > I have a DataGridView control in my Windows Forms application. I am
                    > binding it to a DataTable in another assembly. The name of the assembly is
                    > ActivityListDAL C. I want to bind my grid to
                    > ActivityListDat aSet.ActivityLi stDataTable in this assembly. I selected this
                    > DataTable in the grid's Properties window and it added a component called
                    > ScheduledCallDa taTableBindingS ource to my form. I can also see the column
                    > names in my grid. But when I run the application, the grid displays no row.
                    > Do I need to do anything in the form's load event to make sure the grid gets
                    > populated?
                    >
                    > Thanks in advance.
                    >
                    >
                    >[/color]

                    Comment

                    Working...