Add GUID Column in datagrid

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

    Add GUID Column in datagrid

    Hi

    I've created a GUID column of a table in ms sql server and bind the table to
    a datagrid. How can I automatically create new GUID when i add new row in
    the datagrid.

    Pls help. Thanks.

    Regards
    Melson


  • Terry Burns

    #2
    Re: Add GUID Column in datagrid

    If the table is bound, add the row to the table.

    Dim g As New Guid
    Dim dg As New DataGrid
    Dim t As New DataTable
    Dim c As New DataColumn("MyG uid")
    Dim r As DataRow = t.NewRow()

    t.Columns.Add(c )
    r(0) = g
    t.Rows.Add(r)

    --
    Terry Burns





    "Melson" <wee789@hotmail .com> wrote in message
    news:u67M3ZfZFH A.4036@TK2MSFTN GP10.phx.gbl...[color=blue]
    > Hi
    >
    > I've created a GUID column of a table in ms sql server and bind the table
    > to a datagrid. How can I automatically create new GUID when i add new row
    > in the datagrid.
    >
    > Pls help. Thanks.
    >
    > Regards
    > Melson
    >[/color]


    Comment

    • Ken Tucker [MVP]

      #3
      Re: Add GUID Column in datagrid

      Hi,

      To tell if you are on new row


      You will have to manually change the value for guid column to Guid.NewGuid


      Ken
      -------------------
      "Melson" <wee789@hotmail .com> wrote in message
      news:u67M3ZfZFH A.4036@TK2MSFTN GP10.phx.gbl...
      Hi

      I've created a GUID column of a table in ms sql server and bind the table to
      a datagrid. How can I automatically create new GUID when i add new row in
      the datagrid.

      Pls help. Thanks.

      Regards
      Melson



      Comment

      • Cor Ligthert

        #4
        Re: Add GUID Column in datagrid

        Melson,

        I never tried it, however would not know why this one would not do it.



        I hope this helps,

        Cor


        Comment

        • Terry Burns

          #5
          Re: Add GUID Column in datagrid

          I just think we should

          Freeeeeeee, eeeeeeee, eeeeeeeeeeeeeee , eeeeee,
          eeeeeeeeeeeeeee eeeeeehhhhhhhhh hhhhhhhhhhhhhhh hh

          'Melson' Mandeeellllllll aaaaaaaaaaa, ahhhhhhhhhha, ahhhhhhhhhhhh


          Sorry, could not resist that !

          :)

          --
          Terry Burns

          "Cor Ligthert" <notmyfirstname @planet.nl> wrote in message
          news:esmH0RnZFH A.2444@TK2MSFTN GP15.phx.gbl...[color=blue]
          > Melson,
          >
          > I never tried it, however would not know why this one would not do it.
          >
          > http://msdn.microsoft.com/library/de...ValueTopic.asp
          >
          > I hope this helps,
          >
          > Cor
          >[/color]


          Comment

          Working...