Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / April 2007

Tip: Looking for answers? Try searching our database.

Binding navigator button states

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick - 17 Apr 2007 14:26 GMT
VS 2005

The short version:
   How can I set the enabled state of a button depending on if a
strongly-typed datatable has a DeleteCommand?

***************************

The long version:

I have a windows form with a binding navigator.

There are various strongly-types datatables used throughout the form
attached to controls.

In the navigator RefreshItems event I am setting various buttons enabled
states.  I have a problem with the delete button which I am setting like
this:

navigator.btnDelete.enabled = navigator.bindingSource.AllowRemove

But this always evaluates to TRUE regardless is the underlying bindingsource
datatable has an adapter.DeleteCommand, i.e. its not possible to delete.

So I tried to do the same from a dataview.

Dim dv as DataView = New DataView(myTable)
navigator.btnDelete.enabled = dv.AllowDelete

But this also evaluates to TRUE.

What do I need to test to see if the underlying datatable will allow a
delete?

Rick
Daniel E. Ulfe - 17 Apr 2007 15:54 GMT
Do you want to check if you have enough database level permission to delete
a record?...

If you only want to check if your DataTable has a DeleteCommand... you can
check if for "nothing"... like:

myDeleteButton.Enable = Not myDataTable.DeleteCommand is Nothing

Hope this helps...

Daniel.

> VS 2005
>
[quoted text clipped - 32 lines]
>
> Rick
Rick - 17 Apr 2007 17:37 GMT
Yes, thats what I wanted.  Thanks Daniel

> Do you want to check if you have enough database level permission to
> delete a record?...
[quoted text clipped - 44 lines]
>>
>> Rick
Rick - 17 Apr 2007 22:52 GMT
I spoke too quickly before.

DeleteCommand is a field of DataAdapter not DateTable so it has no
application here unless I am missing something.

AFAIK a the dataadapter on my form has no backwards relationship with the
datatable it originally came from so I can't cast from here either.

Anyone else?

Rick

> Do you want to check if you have enough database level permission to
> delete a record?...
[quoted text clipped - 44 lines]
>>
>> Rick

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.