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 / .NET Framework / General / January 2005

Tip: Looking for answers? Try searching our database.

Apend Row in VB.NET Datagrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joy - 19 Jan 2005 18:16 GMT
Hi,

I need to be able to to disable the Apend Row feature of the VB.NET
datagrid and then enable it again.  The reason is because I want to
allow a user to enter as many rows in the datagrid as they want until a
certain number of rows is reached.  When that number of rows is reached
I want to disable the Apend Row feature - BUT if they delete a row, I
want to enable the Apend Row feature again.  Does that make sense??

I have code that works great to disable the Apend Row feature - but
when I use the same method to enable it again, it doesn't work - it
doesn't produce an error but it just doesn't enable Apend Row feature
again.  Here is the code I am using to disable the Apend Row feature:

Dim cm As CurrencyManager = Me.BindingContext(dgTime.DataSource)
CType(cm.List, DataView).AllowNew = False
CType(cm.List, DataView).AllowDelete = True

Here is the code I am using to try to enable it again:

Dim cm As CurrencyManager = Me.BindingContext(dgTime.DataSource)
CType(cm.List, DataView).AllowNew = True
CType(cm.List, DataView).AllowDelete = True

This code does succesfully set CType(cm.List, DataView).AllowNew = True
but the option to type information into a blank row in the datagrid
never appears.

Can anyone help me??

Thanks!

Joy
Tony - 20 Jan 2005 00:03 GMT
You use two instants, the object is different, try to make one instant.

Dim cm As CurrencyManager = Me.BindingContext(dgTime.DataSource)

and just call this object with new setup, may solve your problem.

Good luck

Tony

> Hi,
>
[quoted text clipped - 29 lines]
>
> Joy
Joy - 20 Jan 2005 00:25 GMT
Let me see if I understand you correctly, are you saying I should
create only one instance of cm, the CurrencyManager??

Joy
Forgotten - 20 Jan 2005 01:01 GMT
When are you making the method call? You say that you are using the same
method to enable and disable the new row feature, but from where is the
method being called for

> Hi,
>
[quoted text clipped - 29 lines]
>
> Joy
Joy Labadie - 20 Jan 2005 16:53 GMT
I use the same code I last posted everywhere I need to set the AllowNew,
or AllowDelete properties of the DataView.  Perhaps part of the problem
is that I am using it repeatedly in so many places - perhaps I should
just do it in one place - but is that what you are suggesting?

Joy

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.