Databound Form - Edit

  • Thread starter Thread starter Vayse
  • Start date Start date
V

Vayse

I want to make all the databound values locked until the user clicks save.
Is there a way doing this, without looping through each control and setting
the ReadOnly = True.



Thanks
Vayse
 
Sorry, correct text should be:

I want to make all the databound values locked until the user clicks Edit.
Is there a way of doing this, without looping through each control and
setting the ReadOnly = True.
 
One way...

1) Drag a Panel object onto your form
2) Place all of your data-aware/editable controls onto the Panel
3) Set the Panel's ENABLED property to FALSE
4) Place your Edit button outside of the Panel, and code it to toggle
the ENABLED property of the Panel
 
Actually, it would be better if the controls were still enabled but read
only.
Theres no read only proprty on the panel.
Any other suggestions?
Thanks
Vayse
 
Hi

Based on my knowledge, you need to set the ReadOnly for each control.
Also, windows form has a Controls collection, you may try to loop through
the collection to set for each control.

e.g.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
On Error Resume Next 'In case certain control has no ReadOnly
property
Dim cnt As Object
For Each cnt In Me.Controls
cnt.readOnly = True
Next
End Sub

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
I think he wanted to avoid doing that, though I think you are correct,
that is the only way for the time being. It would be nice if the
underlying table (or any datacollection that is bindable to a control)
could be made Readonly to assist in this matter.

Would you know if .NET 2.0 offers a bit more with this sort of
functionality?
 
Hi

Based on my research, the problem is more concerned with the UI issue. So I
provide the workaround.

BTW for winforms issue, we have special newgroup for that.

microsoft.public.dotnet.framework.windowsforms.databinding
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.windowsforms

Since VS.NET 2005(Whidbey) has not been released, so far for Whidbey issue,
I think you may try to post in vs2005 forum.
http://lab.msdn.microsoft.com/vs2005/community/

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thanks for the heads up, Pete, I went ahead and subscribed to the
databinding group.

My company is eagerly awaiting for the release of SQL 2005 and VS
2005...the new stuff in these two packages are really go to help us an
awful lot.
 
Hi

Thanks for your quickly reply!


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top