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 General / October 2004

Tip: Looking for answers? Try searching our database.

datagrid delete row and refresh

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rodchar - 13 Oct 2004 15:37 GMT
Hey all,

I have a winform datagrid and when I press delete to delete a row , the
collection item is removed but the datagrid still shows the record. unless i
click somewhere on the datagrid and then the record disappears.

how do i put the two together where when i hit delete the datagrid is updated?

thanks,
rodchar
rodchar - 13 Oct 2004 16:39 GMT
btw,
I'm using a collections class to bind to the datagrid.

> Hey all,
>
[quoted text clipped - 6 lines]
> thanks,
> rodchar
rodchar - 13 Oct 2004 18:15 GMT
here's some code:

   Dim sq As Square
   Dim squares As SquareCollection

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
       DataGrid1.SetDataBinding(squares, "squares")
       squares = New SquareCollection
       squares.Create(10)
       squares.Create(20)
       squares.Create(30)
   End Sub

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
       DataGrid1.DataSource = squares
   End Sub

   Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDelete.Click
       squares.RemoveAt(DataGrid1.CurrentRowIndex)
   End Sub

> Hey all,
>
[quoted text clipped - 6 lines]
> thanks,
> rodchar
Sijin Joseph - 14 Oct 2004 05:01 GMT
You need to makre sure that your custom collection supports change
notification by implementing the IBindingList interface.
http://msdn.microsoft.com/library/en-us/dnadvnet/html/vbnet02252003.asp

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

> here's some code:
>
[quoted text clipped - 30 lines]
>>thanks,
>>rodchar

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.