CSharp/C# >> Enable / Disabled - data entry fields at runtime

by Jeff Gaines » Wed, 03 Sep 2008 18:42:49 GMT

On 03/09/2008 in message < XXXX@XXXXX.COM > Dan
Tallent wrote:

>Anyone have any ideas on how this is normally addressed?

What about using the Tag property of each control to indicate if it should
remain ReadOnly, you could then test for the value of the Tag in your loop.

--
Jeff Gaines Damerham Hampshire UK
I can please only one person per day. Today is not your day.
Tomorrow, isn't looking good either.

CSharp/C# >> Enable / Disabled - data entry fields at runtime

by G.S. » Wed, 03 Sep 2008 23:37:33 GMT



If you're using the standard BindingSource, you may find a neat way of
doing this to be the solution where you extend the BindingSource and
make it render the control read-only based on underlying data element
it binds to.

CSharp/C# >> Enable / Disabled - data entry fields at runtime

by Roger Frost » Thu, 04 Sep 2008 07:06:01 GMT

>> With an additional property the code can be written to Enable the control

Good thinking, and probably the same procedure Jeff had in mind. It seems
much more logical now. I just couldn't wrap my mind around the idea until I
seen this example. Thank you. :) As far as standardized goes, I think the
tag property was created to somewhat standardize non-standard "handling."
Give or take...


But for what it's worth, this is my favorite solution so far...

-Roger Frost

CSharp/C# >> Enable / Disabled - data entry fields at runtime

by Dan Tallent » Thu, 04 Sep 2008 07:26:15 GMT


I am fairly new to C#, but this concept seems interesting. Thanks for idea
I'll check it out.

Thanks again
Dan

Similar Threads

1. Enable / Disabled - data entry fields at runtime - CSharp/C#

2. Allow Data Entry if Field is Null, Disable if Field is not Null

I have a form which has a field Start Date.  I want to only let the user
enter a date if there is no date in the field and never be able to edit the
field.  I have experimented with On Enter and On Click and enabling and
disabling the field but can't get it to work.  Any suggestions?

Thanks in advance


3. Disable Form text fields after Data entry - Access Forms

4. How to disable data entry fields

I have a data entry form that displays in datasheet view.  I have a checkbox 
field called Issue.  When the Issue field is left UNCHECKED I want a date 
field named Completion Date and a checkbox field named FollowUp to be 
disabled so no data entry can be inputted into those fields unless the Issue 
checkbox is checked.  How can I accomplish this?
-- 
Lorraine

5. Fields disappers if data entry set yes - Microsoft Office Access

6. Fields disappers if data entry set yes!!

Hi,
I have form that it is used for entering data in table. When I set the Data 
Entry Property to yes, all the data fields in that form disappear!!! 
Moreover, the form record source is a table not a query. Please advice??

7. Disable fields in a form on open & enable with button click data e - Access Forms

8. CLEAR ALL DATA ON THE FIELDS for data entry (ASP.NET Web program)

Hi all,

I have a data entry form in ASP.NET  (Web development)  which has some 
fields (field1,..., fieldN) , button ADD THIS RECORD, and button CANCEL.
In button ADD THIS RECORD, I have VB.NET Sub function to add this record 
into the table.  I would like to CLEAR ALL DATA ON THE FIELDS to perform 
next data entry after adding a new record  NOT BY assign the value "" for 
each field, but by one line of code.

For example (in my code) :

    Dim myStr as string="INSERT INTO TABLE1(Col1, Col2,..., ColN) 
VALUES(field1.text, field2.text, ..., fieldN.text)"
    Dim myConnection as ODBCConnection= New ODBCConnection(strConn)
    myConnection.Open()

    myCommand = New OdbcCommand(mystr, myConnection)
    myCommand.ExecuteNonQuery()
    myConnection.Close()

    field1.text=""      ' I like to use one line of code NOT by the 
assignment value for each field
    field2.text=""
   ......
    fieldN.text=""


    Could you suggest what I need to use for this purpose ?   Thanks in 
advance