467,179 Members | 1,408 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,179 developers. It's quick & easy.

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
Nov 21 '05 #1
  • viewed: 2148
Share:
4 Replies
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("MyGuid")
Dim r As DataRow = t.NewRow()

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

--
Terry Burns
http://TrainingOn.net


"Melson" <we****@hotmail.com> wrote in message
news:u6**************@TK2MSFTNGP10.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

Nov 21 '05 #2
Hi,

To tell if you are on new row
http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q823q

You will have to manually change the value for guid column to Guid.NewGuid
http://msdn.microsoft.com/library/de...wguidtopic.asp

Ken
-------------------
"Melson" <we****@hotmail.com> wrote in message
news:u6**************@TK2MSFTNGP10.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

Nov 21 '05 #3
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
Nov 21 '05 #4
I just think we should

Freeeeeeee, eeeeeeee, eeeeeeeeeeeeeee, eeeeee,
eeeeeeeeeeeeeeeeeeeeehhhhhhhhhhhhhhhhhhhhhhhhhh

'Melson' Mandeeellllllllaaaaaaaaaaa, ahhhhhhhhhha, ahhhhhhhhhhhh
Sorry, could not resist that !

:)

--
Terry Burns
http://TrainingOn.net
"Cor Ligthert" <no************@planet.nl> wrote in message
news:es**************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

24 posts views Thread by Ilija_G | last post: by
1 post views Thread by Leon | last post: by
26 posts views Thread by John Grandy | last post: by
4 posts views Thread by Dean Slindee | last post: by
4 posts views Thread by David Garamond | last post: by
6 posts views Thread by AlveenX | last post: by
14 posts views Thread by Roy | last post: by
8 posts views Thread by Leon_Amirreza | last post: by
1 post views Thread by Jeff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.