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

form detailview question

P: n/a
GS
in Windows form, I have Datagridview and detailview with the same binding
data manager. upon clicking the + in the navigator, the primary key field is
blank as expected, but I need to enable it for new record to let user to
fill it. On the other hand I don't want to allow change to the field for
existing record. so disable that on existing non new record. How do I do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.
Dec 14 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Are you sure that allowing the user to fill the primary key is a good idea?
These are often left to the database and the insert statement will often
accept all fields _except_ the primary key which is often, by convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same binding
data manager. upon clicking the + in the navigator, the primary key field
is
blank as expected, but I need to enable it for new record to let user to
fill it. On the other hand I don't want to allow change to the field for
existing record. so disable that on existing non new record. How do I do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.

Dec 14 '07 #2

P: n/a
GS
Ordinarily, no.
this form deals with only a small number of named entries possibly less than
50.
the name field is only 16 characters.

and the users using this form is either developer or advanced users trying
to customize the application data extraction pattern.

I suppose I could generate primary key and have unique index on name
field.. however in the application the references are by name not by other
key for ease of use and maintenance by user.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:3A**********************************@microsof t.com...
Are you sure that allowing the user to fill the primary key is a good
idea?
These are often left to the database and the insert statement will often
accept all fields _except_ the primary key which is often, by convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same
binding
data manager. upon clicking the + in the navigator, the primary key
field
is
blank as expected, but I need to enable it for new record to let user to
fill it. On the other hand I don't want to allow change to the field for
existing record. so disable that on existing non new record. How do I do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.

Dec 15 '07 #3

P: n/a
I think that even with advanced users, the primary key is best left to some
automated process. User entered data tends to be subject to abuse, like
someone calling all their entries "fred" or such.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:OT**************@TK2MSFTNGP03.phx.gbl...
Ordinarily, no.
this form deals with only a small number of named entries possibly less
than
50.
the name field is only 16 characters.

and the users using this form is either developer or advanced users trying
to customize the application data extraction pattern.

I suppose I could generate primary key and have unique index on name
field.. however in the application the references are by name not by
other
key for ease of use and maintenance by user.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:3A**********************************@microsof t.com...
>Are you sure that allowing the user to fill the primary key is a good
idea?
>These are often left to the database and the insert statement will often
accept all fields _except_ the primary key which is often, by convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same
binding
data manager. upon clicking the + in the navigator, the primary key
field
is
blank as expected, but I need to enable it for new record to let user
to
fill it. On the other hand I don't want to allow change to the field
for
existing record. so disable that on existing non new record. How do I
do
that?
I notice the property of the fields are enabled in the form design, but
could not find any code for disable them.


Dec 15 '07 #4

P: n/a
GS
then it is the users wish to go against company policy to make meaningful
name. and he is going to suffer from the potential gain of meaning.
autogenerated key has no meaning neither. for alpha key in large table,
wide scatter of key values help performance but I double if small number of
similar key name make much difference in small tables of 100 entries or
less.

Furthermore, as long as the entry is not referenced, user will be allowed to
rename, change, delete. Once the entry is referenced , no change is allowed.
except for the admin person.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:D0**********************************@microsof t.com...
I think that even with advanced users, the primary key is best left to
some
automated process. User entered data tends to be subject to abuse, like
someone calling all their entries "fred" or such.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:OT**************@TK2MSFTNGP03.phx.gbl...
Ordinarily, no.
this form deals with only a small number of named entries possibly less
than
50.
the name field is only 16 characters.

and the users using this form is either developer or advanced users
trying
to customize the application data extraction pattern.

I suppose I could generate primary key and have unique index on name
field.. however in the application the references are by name not by
other
key for ease of use and maintenance by user.

"Bob Powell [MVP]" <bo*@spamkillerbobpowell.netwrote in message
news:3A**********************************@microsof t.com...
Are you sure that allowing the user to fill the primary key is a good
idea?
These are often left to the database and the insert statement will
often
accept all fields _except_ the primary key which is often, by
convention,
autogenerated.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"GS" <gs**********************@msnews.Nomail.comwrote in message
news:eR**************@TK2MSFTNGP03.phx.gbl...
in Windows form, I have Datagridview and detailview with the same
binding
data manager. upon clicking the + in the navigator, the primary key
field
is
blank as expected, but I need to enable it for new record to let user
to
fill it. On the other hand I don't want to allow change to the field
for
existing record. so disable that on existing non new record. How do I
do
that?
I notice the property of the fields are enabled in the form design,
but
could not find any code for disable them.



Dec 17 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.