473,326 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

clear datagrid

my datagrid is bind to the table, I need to check clear when the user didn't
input the figure.
my code list as follow. when the datagrid got less then 100 tables, the code
works, However, when it over 100 rows. it can't work.
Does anything wrong with my code ?
Please help
P.S - I can't use delete since the user remove the unused record before
save.

Dim cm As CurrencyManager = Me.BindingContext(dsRvPvHeader,
"myInvTable")
cm.EndCurrentEdit()
For i = 1 To cm.Count
If cm.Current.item("debit") = 0 And
cm.Current.item("credit") = 0 And cm.Current.item("voucherno") =
Me.txtVoucherNo.Text Then
cm.RemoveAt(cm.Position)
Else
cm.Position += 1
End If
Next
End If
cm.Refresh()
cm.EndCurrentEdit()
Oct 23 '06 #1
1 1577
Why do you have cm.EndCurrentEdit() twice? Maybe you meant start?
On Oct 23, 11:40 am, "Agnes" <a...@dynamictech.com.hkwrote:
my datagrid is bind to the table, I need to check clear when the user didn't
input the figure.
my code list as follow. when the datagrid got less then 100 tables, the code
works, However, when it over 100 rows. it can't work.
Does anything wrong with my code ?
Please help
P.S - I can't use delete since the user remove the unused record before
save.

Dim cm As CurrencyManager = Me.BindingContext(dsRvPvHeader,
"myInvTable")
cm.EndCurrentEdit()
For i = 1 To cm.Count
If cm.Current.item("debit") = 0 And
cm.Current.item("credit") = 0 And cm.Current.item("voucherno") =
Me.txtVoucherNo.Text Then
cm.RemoveAt(cm.Position)
Else
cm.Position += 1
End If
Next
End If
cm.Refresh()
cm.EndCurrentEdit()
Oct 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Weeepie | last post by:
Hello, Is it possible to clear a datagrid in VBdotNET? I'm using a query to fill the datagrid, but when I change the parameter, the next query follows the previous. Is there someone who can...
4
by: Mike L | last post by:
This is for a Win form. How do I clear all the rows in a datagrid? How do I add a record to a datagrid?
1
by: Lee Price | last post by:
This is with regard to my previous post for resetting my DataGrid, and I was adviced to use the clear function on DataGrid items by Sachan The datagrid does not have a Clear function and I get...
1
by: John Smith | last post by:
What are all the options to clear the rows in a datagrid? ..Net Framework 1.1. ASP.Net Thanks, Smith
4
by: aikwee | last post by:
how, how do i clear the current content of a datagrid? I am using datagrid to do a xml editor, so every time i try to open anther file and load it to datagrid, it actually append it in to...
4
by: Alan | last post by:
I have set the datasource of the datagrid to a datatable. How do I clear the datagrid contents before refill the datagrid everytime ?
0
by: Flack | last post by:
I have pasted at the end of this message a small sample program I whipped up to do some testing. It's a form with a datagrid and two buttons. Each button clears the dataTable that is the source...
2
by: harini | last post by:
hi, i have a radio button. On clicking the radio button i have to clear the already existing tablestyle of my datagrid and bind a new table to the grid with a new tablestyle. i used, ...
5
by: Steve | last post by:
In VB6 I have a screen the has a text box and a datagrid If I click the datagrid, the 1st event is to validate the textbox and then the 2nd event is a datagrid mousedown event. If a get an error...
4
by: inadsad | last post by:
Good day Group, I have a form with a datagrid and two buttons. On show button datagrid is populated with a datatable and on clear button datagrid is cleared. DataTable.Clear not only removes...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.