473,407 Members | 2,676 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,407 software developers and data experts.

Why doesn't changing the position in a table change the position of the DatGridView that's bound to it?

I have these four methods to change the position in a table. However when I invoke any of them nothing appears to happen to the table. It doesn't scroll. The selector pointer doesn't move. Nada!!
If I check the row in the table (DataTable2), it IS changing as it should and the DGV IS bound to the data table.

Private Sub cmdFirst_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFirst.Click
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition = 0
End Sub
Private Sub cmdLast_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLast.Click
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition = MyDataSet.Tables("DataTable2").Rows.Count
End Sub
Private Sub cmdNext_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdNext.Click
If BindingContext(MyDataSet.Tables("DataTable2")).Pos ition < MyDataSet.Tables("DataTable2").Rows.Count Then
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition += 1
End If
End Sub
Private Sub cmdPrevious_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPrevious.Click
If BindingContext(MyDataSet.Tables("DataTable2")).Pos ition > 0 Then
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition -= 1
End If
End Sub
Jun 2 '06 #1
2 1284
Sam,

In version 2005 it is easier to use the bindingsource.

See this sample on our webview
http://www.vb-tips.com/default.aspx?...8-4e3f3fedb997

I hope this helps,

Cor
"Sam Malone" <th************@hotmail.com> schreef in bericht news:eY**************@TK2MSFTNGP03.phx.gbl...
I have these four methods to change the position in a table. However when I invoke any of them nothing appears to happen to the table. It doesn't scroll. The selector pointer doesn't move. Nada!!
If I check the row in the table (DataTable2), it IS changing as it should and the DGV IS bound to the data table.

Private Sub cmdFirst_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFirst.Click
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition = 0
End Sub
Private Sub cmdLast_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLast.Click
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition = MyDataSet.Tables("DataTable2").Rows.Count
End Sub
Private Sub cmdNext_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdNext.Click
If BindingContext(MyDataSet.Tables("DataTable2")).Pos ition < MyDataSet.Tables("DataTable2").Rows.Count Then
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition += 1
End If
End Sub
Private Sub cmdPrevious_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPrevious.Click
If BindingContext(MyDataSet.Tables("DataTable2")).Pos ition > 0 Then
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition -= 1
End If
End Sub
Jun 2 '06 #2
OH GOODIE!!! and just when I thought I was beginning to understand the other stuff :=) Thanks a bunch. I'll have a look at it, Cor. Appreciate the help.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message news:eU**************@TK2MSFTNGP04.phx.gbl...
Sam,

In version 2005 it is easier to use the bindingsource.

See this sample on our webview
http://www.vb-tips.com/default.aspx?...8-4e3f3fedb997

I hope this helps,

Cor
"Sam Malone" <th************@hotmail.com> schreef in bericht news:eY**************@TK2MSFTNGP03.phx.gbl...
I have these four methods to change the position in a table. However when I invoke any of them nothing appears to happen to the table. It doesn't scroll. The selector pointer doesn't move. Nada!!
If I check the row in the table (DataTable2), it IS changing as it should and the DGV IS bound to the data table.

Private Sub cmdFirst_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdFirst.Click
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition = 0
End Sub
Private Sub cmdLast_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdLast.Click
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition = MyDataSet.Tables("DataTable2").Rows.Count
End Sub
Private Sub cmdNext_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdNext.Click
If BindingContext(MyDataSet.Tables("DataTable2")).Pos ition < MyDataSet.Tables("DataTable2").Rows.Count Then
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition += 1
End If
End Sub
Private Sub cmdPrevious_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPrevious.Click
If BindingContext(MyDataSet.Tables("DataTable2")).Pos ition > 0 Then
BindingContext(MyDataSet.Tables("DataTable2")).Pos ition -= 1
End If
End Sub
Jun 2 '06 #3

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

Similar topics

2
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
149
by: Christopher Benson-Manica | last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.) strchr() is to strrchr() as strstr() is to strrstr(), but strrstr() isn't part of the standard. Why not? --...
0
by: Cato Lommerud | last post by:
I have a datagrid control that shows the result from an Acces View and I want to change the current record for other bound controls when the user clicks in the different rows in the datagrid. Since...
4
by: Jeremy | last post by:
I have a dataset containing 2 tables. A is the master table, B is a lookup table. There is a combobox bound to B, which updates a value in a FK field in A. my currencymanager is created thus:...
0
by: LeAnne | last post by:
In my ASPX page, I populate the GRID when the user selects an item in the dropdown list. Thus, the data is fetched and the data grid DataBind() method is executed in the PostBack (i.e. IsPostBack...
18
by: Chris Hills | last post by:
A lesson in Posting How many C.L.C group posters does it take to change a C light bulb? 1 to change the light bulb and to post that the light bulb has been changed 14 to share similar...
4
by: rszebras | last post by:
I inherited a database (as a novice at Access) and need to modify it to make it more efficient, i.e., the assignment form needs to autopopulate with the client's name, address, phone number, etc.,...
1
by: gba | last post by:
I have a dataset ontianing 3 columns (name,properties,type) I'm able to bound this dataset to a datagridview my problem is for the type column. What I like to have is a combobox containing tree...
1
by: thesti | last post by:
hi, i'm going to develop a program using VB .NET. i've bound some textboxes to the same DataSource (DataSet1.Tables(0). and i enable the user to type the primaryKey of the data in the Table,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.