VB .NET master\detail database update position Datagridview

Posted on 2009-05-11
Last Modified: 2013-12-26
I have a master\detail database with two tables, I have connected them in one dataset and made the relatioship,
I insert on the form one textbox with the databinding to the field of the master table and a datagridview to the datasource and datamember of the detail table.
I want to have a button to move to the next row of the master and to follow the datagrid to the details of the of the record of the textbox.
here is some code wich is not working.
Private Sub SetRowPos(ByVal intPos As Integer)


        Me.BindingContext(DataSet81, "EPONIMIA").Position = intPos

        DataGrid1.NavigateTo(intPos, "KATASTASI")

    End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim intpos As New Int32


            intpos = Me.BindingContext(DataSet81, "EPONIMIA").Position

            intpos += 1


        Catch errobj As Exception

            MsgBox(errobj.Message & vbCrLf & errobj.StackTrace)

        End Try

Open in new window

Question by:kyriakos70
  • 3
  • 2

Accepted Solution

Deathrace earned 500 total points
Comment Utility
correct me if i'm wrong, you are looking to populate Details view for a particular ..if so refer below links

Expert Comment

Comment Utility
above link helps you how to nagivate between the records in DB table...

Assisted Solution

Deathrace earned 500 total points
Comment Utility
how to use binding context, for navigation.

Author Comment

Comment Utility
I need the procedure exactly on how to show the master table to textbox and the details to a datagrid.


Author Comment

Comment Utility
I have two tables master with two fields id=pk and EPONIMIA = char I set up 2 sqldataadapters one for the master and one for the detail table. I have generated a dataset and made the relationship inside the dataset by drag and drop the master pk to the detail fk. I have put on a form 2 texboxes one for each field of the master and a datagridview for the detailthe datagridview datasource to the detail table.
But when I run the application the datagrid view displays all the records I want to display only the records shown in the textboxes.

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now