473,739 Members | 5,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

textboxes databinding and navigating

Hi

I have a problem with two textboxes binded to a dataset, based on paren
table, and table for the child records.
I can navigate between the master records (and of course the child records
are changed according to the datarelation), but when I try to add a new
record, and then try to navigate between master records, the child records
are noot changing.

Does anyone have a solution?

Here is the code I used:

Code:
Function CraeteDataset(B yVal strConnection As String, ByVal stWhereClause As
String) As DataSet
Dim stMasterKeyColu mns() As String = {"compid", "customer_i d"}
Dim stDetailKeyColu mns() As String = {"compid", "entity_id" }
Try
Dim dsData As New DataSet
Dim stWhereClauseAd d As String
Dim drDataRow As DataRow
dsData = clsDBGEN.FillDa taSet(strConnec tion, "table1", _
"select * from table1", False, "table1", dsData)
dsData = clsDBGEN.FillDa taSet(strConnec tion, "table2", _
"select * from table2", False, "table2", dsData)
dsData = clsDBGEN.Create Relationship("t able1", "table2", _
stMasterKeyColu mns, stDetailKeyColu mns, "table1tabl e2", dsData)
dsData = clsDBGEN.Create Relationship("t able1", "table3", _
Return dsData
Catch ex As Exception
HandleException s(ex)
End Try
End Function

Private Sub FillHeader(ByRe f dsDataSet As DataSet)
Try
stDataSetTable = dsDataSet.Table s.Item("table1" ).ToString
txtId.DataBindi ngs.Add(New Binding("text", dsDataSet,
stDataSetTable & ".id"))
txtName.DataBin dings.Add(New Binding("text", dsDataSet,
stDataSetTable & ".name"))
Catch ex As Exception
HandleException s(ex)
MsgBox("Query caused no record to be retrieved",
MsgBoxStyle.Inf ormation)
End Try
End Sub

Private Sub FillLines(ByRef dsDataSet As DataSet)
Try
For Each drDataRow As DataRow In dsDataSet.Table s("table2").Row s
If drDataRow("comp id") = dCompid And drDataRow("enti ty_id") = _
txtId.Text Then
txtStreet.DataB indings.Add("te xt", dsDataSet,
"table1.table1t able2.street")
End If
Next
Catch ex As Exception
HandleException s(ex)
MsgBox("Query caused no record to be retrieved",
MsgBoxStyle.Inf ormation)
End Try
End Sub
Here is the code for navigating next for example:

Code:
Sub MoveNext(ByVal dsDataSet As DataSet, ByVal stDataSetTable As String)
Try
bdRecordNavigat or = BindingContext( dsDataSet, stDataSetTable)
bdRecordNavigat or.EndCurrentEd it()
bdRecordNavigat or.Position += 1
Catch ex As Exception
HandleException s(ex)
End Try
End Sub

Mar 30 '07 #1
0 1170

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

Similar topics

3
1397
by: Lloyd Sheen | last post by:
I have several apps that use a roll your own approach, but I am embarking on a project which will not allow that with the time constraints. I have gened up a little app to try the databinding approach. Simply it is a page to maintain the Territories table in Northwind (SQL Server). I have two SqlDataAdaptors - one for the list of Territories - on for the individual Territories row (uses parameter to select)
12
2649
by: Mike | last post by:
I'm calling a component to get my data. The component is returning a dataset. I need to populate text boxes on my aspx page with the data within the datalist. Where can I find an example that does this? Here is the code i'm using and i'm gettting an error: code: Try dbConn.GetCarInformation(CarID)
0
1400
by: Coco | last post by:
Hi, who knows how to update the 'child' textboxes in a datarelated situation if the child records "doesn't yet exitsts/are still empty"? The problem can be explained with the Northwind database. Parenttable = Customers with some databound textboxes Childtable = Orders with some databound textboxes Parent-Child Datarelation on field CustomerId I.e. Customer FISSA doesn't yet have Orders. So when I navigate (code not
8
13352
by: stephen.clancy | last post by:
I have created a Table on the fly with embedded textboxes. I need to update a database based on the input to these textboxes. What's the best approach? Sample of setup; Table table = new Table(); table.CellPadding = 5; table.ID = "Results"; cell = new TableCell();
11
11574
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set object and displays the data correctly when I move from row to row. The problem I am having is the data set always reads the data back and considers it change even when it's not. I am looking for how to change the following code so the...
1
1637
by: Pieter | last post by:
Hi, My problem: When the cursor is on a given row in the DataGridView, the data in the row has to be shown in TextBoxes underneath the DataGridView. the user must be able to edit in the Datagridview, or in the textboxes. The text in these textboxes and the datagridview has to be synchronsied at all time. So if the user types "a" in the Name-Column, the "a" has to appear immediately in the Textbox etc.
5
1745
by: Patrick | last post by:
I've been struggling with a while. Could someone please help me out? I need to bind a property (wich is an custom object) to a combobox that contains a list of the same objects. ex: class Manager() { public Employee EmployeeInfo }
0
2024
by: Chris | last post by:
Hello, I have a problem with re-loading datasets. As a simple example, if I have an SQL table of addresses comprising active and inactive addresss, I wish to load either sub-set by clicking on a checkBox. The data is Bound to various controls on a Windows Form. This works fine, I can load either set of data into the same
7
4140
by: =?Utf-8?B?Sm9lIFRob21wc29u?= | last post by:
Hi, I have a C# windows form application (.NET 2.0) that reads data over the serial port and displays the data via textboxes. I get a message 50 times/second. I know I can't update the screen that fast but I would like to update the data maybe twice a second. Currently, I have about 20 textboxes that get updated at once. This seems to be a pretty slow process. I'm looking for suggestions. What is the best way to update the .text...
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
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
9266
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
6054
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
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
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

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.