using datagrid field values in multiple forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wishing I was skiing mom

    #1

    using datagrid field values in multiple forms

    In form1, which is an item master maintenance screen, I have a button which
    launches form2. Form2 contains an item master datagrid. After the user
    double-clicks the desired item record in form2 I want the field values from
    the selected record to populate text boxes in form 1 so the user can make
    changes to the item (ie. description, cost etc.). I have gotten as far as
    populating a field in form1 with the mapping name or the current row index
    from the datagrid as shown in the code directly below but not the actual
    field value.
    myForm1.ItemId = dgdMinorMateria l1.CurrentRowIn dex

    I tried this code below, which looks good, but I receive the error message
    that follows.
    myForm1.ItemId = MinorMaterialDa taSet1.tblMinor Material.mmItem IdColumn
    Value of type 'System.Data.Da taColumn' cannot be converted to 'String'.

    Can anyone help me out here? Thanks.
  • Dave

    #2
    Re: using datagrid field values in multiple forms

    Use the DataGrid indexer:

    Gets or sets the value of the cell at the specified the row and column.

    public object this[
    int rowIndex,
    int columnIndex
    ] {get; set;}

    ^^ From MDSN.

    --
    Dave Sexton
    dave@www..jwaon line..com
    -----------------------------------------------------------------------
    "Wishing I was skiing mom" <WishingIwasski ingmom@discussi ons.microsoft.c om> wrote in message
    news:B85B2811-389D-494D-808E-92FCE9E876DC@mi crosoft.com...[color=blue]
    > In form1, which is an item master maintenance screen, I have a button which
    > launches form2. Form2 contains an item master datagrid. After the user
    > double-clicks the desired item record in form2 I want the field values from
    > the selected record to populate text boxes in form 1 so the user can make
    > changes to the item (ie. description, cost etc.). I have gotten as far as
    > populating a field in form1 with the mapping name or the current row index
    > from the datagrid as shown in the code directly below but not the actual
    > field value.
    > myForm1.ItemId = dgdMinorMateria l1.CurrentRowIn dex
    >
    > I tried this code below, which looks good, but I receive the error message
    > that follows.
    > myForm1.ItemId = MinorMaterialDa taSet1.tblMinor Material.mmItem IdColumn
    > Value of type 'System.Data.Da taColumn' cannot be converted to 'String'.
    >
    > Can anyone help me out here? Thanks.[/color]


    Comment

    • Wishing I was skiing mom

      #3
      Re: using datagrid field values in multiple forms

      Thanks Dave, That sent me in right direction and I got it to work, now I can
      stop pulling my hair out.

      "Dave" wrote:
      [color=blue]
      > Use the DataGrid indexer:
      >
      > Gets or sets the value of the cell at the specified the row and column.
      >
      > public object this[
      > int rowIndex,
      > int columnIndex
      > ] {get; set;}
      >
      > ^^ From MDSN.
      >
      > --
      > Dave Sexton
      > dave@www..jwaon line..com
      > -----------------------------------------------------------------------
      > "Wishing I was skiing mom" <WishingIwasski ingmom@discussi ons.microsoft.c om> wrote in message
      > news:B85B2811-389D-494D-808E-92FCE9E876DC@mi crosoft.com...[color=green]
      > > In form1, which is an item master maintenance screen, I have a button which
      > > launches form2. Form2 contains an item master datagrid. After the user
      > > double-clicks the desired item record in form2 I want the field values from
      > > the selected record to populate text boxes in form 1 so the user can make
      > > changes to the item (ie. description, cost etc.). I have gotten as far as
      > > populating a field in form1 with the mapping name or the current row index
      > > from the datagrid as shown in the code directly below but not the actual
      > > field value.
      > > myForm1.ItemId = dgdMinorMateria l1.CurrentRowIn dex
      > >
      > > I tried this code below, which looks good, but I receive the error message
      > > that follows.
      > > myForm1.ItemId = MinorMaterialDa taSet1.tblMinor Material.mmItem IdColumn
      > > Value of type 'System.Data.Da taColumn' cannot be converted to 'String'.
      > >
      > > Can anyone help me out here? Thanks.[/color]
      >
      >
      >[/color]

      Comment

      Working...