473,385 Members | 1,282 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,385 software developers and data experts.

Is it a bug or I am doing something wrong.

Pat
Hi Guys,

Please help me. I am having a strange issue. Not sure if I am doing
something wrong or this is a bug.
This is a sample code.
This contains 2 text boxes(txtName, txtPhone) and 2 buttons (btnAdd,
btnSave)
Table(dtCustomers) contains three rows, with customer name "a", "b" and "c".
Now I press "btnAdd" button to add a new row.
Then I type "d" as name and "123" ad phone number.
Now I press save. That's when the problem occurs.
Momemt I press cm.EndCurrentEdit, it not only changes the position but it
also change the row. Instead of staying with customer "d" it goes to
customer "b".
And I have no clue why it goes to customer "d", when it should only change
the position based on the sort.

Please help me. I am stuck on this for some time now.
Let me know I need to include something. Please also let me know if you
cannot duplicate this issue.
I am using Visual Studio 2005 version 8.0.50727.762 (SP.050727-7600)

Dim cm As CurrencyManager
Dim dtCustomers As New DataTable

Sub New()

' This call is required by the Windows Form Designer.
InitializeComponent()

' Add any initialization after the InitializeComponent() call.

dtCustomers.Columns.Add("CustomerID", GetType(Integer))
dtCustomers.Columns.Add("Name", GetType(String))
dtCustomers.Columns.Add("Phone", GetType(String))
dtCustomers.Rows.Add(New Object() {1, "a", "1111"})
dtCustomers.Rows.Add(New Object() {2, "b", "2234567890"})
dtCustomers.Rows.Add(New Object() {3, "c", "3234567890"})
dtCustomers.DefaultView.Sort = "Phone"
cm = CType(Me.BindingContext(dtCustomers.DefaultView),
CurrencyManager)

Me.txtName.DataBindings.Add("Text", dtCustomers.DefaultView, "Name")
Me.txtPhone.DataBindings.Add("Text", dtCustomers.DefaultView,
"Phone")
dtCustomers.Columns("CustomerID").DefaultValue = -1

End Sub

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Me.cm.AddNew()
End Sub

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Dim _CustomerID As Integer = Me.cm.Current("CustomerID")
Me.cm.EndCurrentEdit()
If Me.cm.Current("CustomerID") <_CustomerID Then
Stop
Exit Sub
End If
End Sub
Aug 26 '08 #1
0 1103

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

Similar topics

3
by: Amy G | last post by:
I have a whole bunch of tuples that look something like this, aTuple = ('1074545869.6580.msg', 't_bryan_pw@gmcc.ab.ca', 'Your one stop prescriptions') now that I have this I try for x, y, z...
2
by: Graham Mattingley | last post by:
I am trying to count the records in a database, and make an array from the answer this is the code strQuery = "SELECT count(*) FROM resort where island_id= '"&island_drop&"' ;" Set...
6
by: Michael Sparks | last post by:
Hi, I suspect this is a bug with AMK's Crypto package from http://www.amk.ca/python/code/crypto , but want to check to see if I'm being dumb before posting a bug report. I'm looking at...
3
by: Michel Rouzic | last post by:
I got a loop checking if the system time has took one more second or not since last iteration, works nicely, but it uses the whole CPU. I've read many previous topics on c.l.c about wait() type...
5
by: Simon Brooke | last post by:
This is supposed to be a very simple XSL stylesheet to strip styling information out of HTML documents - it could not be more basic. And yet, it doesn't work. I'm obviously getting something very...
8
by: watkinsdev | last post by:
Hi, I have created a mesh class in visual studio 6.0 c++. I can create a device, render objects and can edit the objects by for instancnce selecting a cluster of vertices and processing the...
16
by: SirG | last post by:
I'm looking for an explanation of why one piece of code works and another does not. I have to warn you that this is the first piece of Javascript I've ever written, so if there is a better way or a...
10
by: shapper | last post by:
Hello, I have a custom control under namespace MyNameSpace.WebControls with a property of type validation: ' Validation Private _Validation As Validation < _ Bindable(True), _...
34
by: raphfrk | last post by:
This program should copy one file onto the other. It works if I compile it with gcc to a cygwin program. However, if I compile it with the -mno-cygwin option, it doesn't work (this targets native...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.