By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,285 Members | 1,691 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,285 IT Pros & Developers. It's quick & easy.

Add GUID Column in datagrid

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.