form detailview question

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

    #1

    form detailview question

    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.


  • Bob Powell [MVP]

    #2
    Re: form detailview question

    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


    Find great Windows Forms articles in Windows Forms Tips and Tricks


    Answer those GDI+ questions with the GDI+ FAQ


    All new articles provide code in C# and VB.NET.
    Subscribe to the RSS feeds provided and never miss a new article.


    "GS" <gsmsnews.micro soft.comGS@msne ws.Nomail.comwr ote in message
    news:eRPPE2oPIH A.3556@TK2MSFTN GP03.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.
    >
    >

    Comment

    • GS

      #3
      Re: form detailview question

      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]" <bob@spamkiller bobpowell.netwr ote in message
      news:3ABEDF9C-F6E0-4AF6-B140-AAF217390DEE@mi crosoft.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

      >
      Find great Windows Forms articles in Windows Forms Tips and Tricks

      >
      Answer those GDI+ questions with the GDI+ FAQ

      >
      All new articles provide code in C# and VB.NET.
      Subscribe to the RSS feeds provided and never miss a new article.
      >
      >
      "GS" <gsmsnews.micro soft.comGS@msne ws.Nomail.comwr ote in message
      news:eRPPE2oPIH A.3556@TK2MSFTN GP03.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.
      >

      Comment

      • Bob Powell [MVP]

        #4
        Re: form detailview question

        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


        Find great Windows Forms articles in Windows Forms Tips and Tricks


        Answer those GDI+ questions with the GDI+ FAQ


        All new articles provide code in C# and VB.NET.
        Subscribe to the RSS feeds provided and never miss a new article.


        "GS" <gsmsnews.micro soft.comGS@msne ws.Nomail.comwr ote in message
        news:OTX$hzuPIH A.1208@TK2MSFTN GP03.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]" <bob@spamkiller bobpowell.netwr ote in message
        news:3ABEDF9C-F6E0-4AF6-B140-AAF217390DEE@mi crosoft.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,
        >autogenerate d.
        >>
        >--
        >--
        >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" <gsmsnews.micro soft.comGS@msne ws.Nomail.comwr ote in message
        >news:eRPPE2oPI HA.3556@TK2MSFT NGP03.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.
        >
        >
        >>
        >
        >

        Comment

        • GS

          #5
          Re: form detailview question

          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]" <bob@spamkiller bobpowell.netwr ote in message
          news:D0A0C151-64BE-4B8C-B034-36037F7AA9A6@mi crosoft.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

          >
          Find great Windows Forms articles in Windows Forms Tips and Tricks

          >
          Answer those GDI+ questions with the GDI+ FAQ

          >
          All new articles provide code in C# and VB.NET.
          Subscribe to the RSS feeds provided and never miss a new article.
          >
          >
          "GS" <gsmsnews.micro soft.comGS@msne ws.Nomail.comwr ote in message
          news:OTX$hzuPIH A.1208@TK2MSFTN GP03.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]" <bob@spamkiller bobpowell.netwr ote in message
          news:3ABEDF9C-F6E0-4AF6-B140-AAF217390DEE@mi crosoft.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

          >
          Find great Windows Forms articles in Windows Forms Tips and Tricks

          >
          Answer those GDI+ questions with the GDI+ FAQ

          >
          All new articles provide code in C# and VB.NET.
          Subscribe to the RSS feeds provided and never miss a new article.
          >
          >
          "GS" <gsmsnews.micro soft.comGS@msne ws.Nomail.comwr ote in message
          news:eRPPE2oPIH A.3556@TK2MSFTN GP03.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.


          >
          >

          Comment

          Working...