473,803 Members | 3,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.EventArg s) Handles cmdFirst.Click
BindingContext( MyDataSet.Table s("DataTable2") ).Position = 0
End Sub
Private Sub cmdLast_Click(B yVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdLast.Click
BindingContext( MyDataSet.Table s("DataTable2") ).Position = MyDataSet.Table s("DataTable2") .Rows.Count
End Sub
Private Sub cmdNext_Click(B yVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdNext.Click
If BindingContext( MyDataSet.Table s("DataTable2") ).Position < MyDataSet.Table s("DataTable2") .Rows.Count Then
BindingContext( MyDataSet.Table s("DataTable2") ).Position += 1
End If
End Sub
Private Sub cmdPrevious_Cli ck(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdPrevious.Cli ck
If BindingContext( MyDataSet.Table s("DataTable2") ).Position > 0 Then
BindingContext( MyDataSet.Table s("DataTable2") ).Position -= 1
End If
End Sub
Jun 2 '06 #1
2 1306
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******** ******@TK2MSFTN GP03.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.EventArg s) Handles cmdFirst.Click
BindingContext( MyDataSet.Table s("DataTable2") ).Position = 0
End Sub
Private Sub cmdLast_Click(B yVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdLast.Click
BindingContext( MyDataSet.Table s("DataTable2") ).Position = MyDataSet.Table s("DataTable2") .Rows.Count
End Sub
Private Sub cmdNext_Click(B yVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdNext.Click
If BindingContext( MyDataSet.Table s("DataTable2") ).Position < MyDataSet.Table s("DataTable2") .Rows.Count Then
BindingContext( MyDataSet.Table s("DataTable2") ).Position += 1
End If
End Sub
Private Sub cmdPrevious_Cli ck(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdPrevious.Cli ck
If BindingContext( MyDataSet.Table s("DataTable2") ).Position > 0 Then
BindingContext( MyDataSet.Table s("DataTable2") ).Position -= 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******** ******@TK2MSFTN GP04.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******** ******@TK2MSFTN GP03.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.EventArg s) Handles cmdFirst.Click
BindingContext( MyDataSet.Table s("DataTable2") ).Position = 0
End Sub
Private Sub cmdLast_Click(B yVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdLast.Click
BindingContext( MyDataSet.Table s("DataTable2") ).Position = MyDataSet.Table s("DataTable2") .Rows.Count
End Sub
Private Sub cmdNext_Click(B yVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdNext.Click
If BindingContext( MyDataSet.Table s("DataTable2") ).Position < MyDataSet.Table s("DataTable2") .Rows.Count Then
BindingContext( MyDataSet.Table s("DataTable2") ).Position += 1
End If
End Sub
Private Sub cmdPrevious_Cli ck(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArg s) Handles cmdPrevious.Cli ck
If BindingContext( MyDataSet.Table s("DataTable2") ).Position > 0 Then
BindingContext( MyDataSet.Table s("DataTable2") ).Position -= 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
2631
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 form is opened. After the user selects the contact from an unbound combobox I want the form to be rebound to its recordsource. I tried using form.recordsource = "Contacts" in the afterupdate event of
149
25219
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? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
0
959
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 the datagrid only contains a subset of the possible current records for the bound controls. Since the datagrid only shows a subset of the records, I can't use the current row as the position in the binding context, but I have the primary key...
4
4125
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: cmB= CType(frm.BindingContext(DsClient1.Tables("B")), CurrencyManager) The cbx has these settings: cbx.valuemember=b.primarykey cbx.displaymember=b.name
0
1137
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 = TRUE on the server side). At this time the data grid has some information and is now displayed. How ever, the OnItemCommand that I've specified in the data grid doesn't seem to get executed at ALL. I.e. i've placed a simple button control...
18
2213
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 experiences of changing light bulbs and how the light bulb could have been changed differently
4
2743
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., when you select the cust id. Found this cited as a good method: http://www.mvps.org/access/forms/frm0058.htm I have two tables (clients, assignments) and one form (assignment input) in the database. I have a control box called CUST ID in the...
1
1560
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 choice (selection1,selection2,selection3) the issue is my dataset do not contain the collection of the 3 item but only the selected one.
1
1221
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, so if the user has typed an existing PK in the table, the position of the CurrencyManager will be changed. in the 'KeyUp' event of the ID textBox, i implement this code Private Sub txtID_KeyUp(ByVal sender As Object, ByVal e As...
0
10316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10295
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.