473,574 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help on databinding with tabpages

I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
information about a particular Seller and is read from a
SellerDataview at form load.

On Tabpages 2-7, the information comes from another table/another
DealDataview.

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard



Nov 21 '05 #1
7 3566
Hi,

Here a link on how to bind a control to a datasource.
http://msdn.microsoft.com/library/de...dingstopic.asp

VB.net does not update the info in bound controls until they are
shown. Since all the tabpages are not visible when the form is loaded the
controls on those tabpages will not contain data until they are shown.

Ken
-----------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:n3******** *************** *********@4ax.c om...
I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
information about a particular Seller and is read from a
SellerDataview at form load.

On Tabpages 2-7, the information comes from another table/another
DealDataview.

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard


Nov 21 '05 #2
Thanks for this Ken.

The form works well with the controls on the form itself. However on
the tabpages they will not show the data. Even adding the statement

for each tb as tabpage in tabcontrol.page s
tb.bindingconte xt = me.bindingconte xt
next tb

and, at the end of the load process

tabpage1.show()
tabpage2.show()

seems to have no effect.

Or do I need to show each tabpage before I am able to bind the
controls that exist on each tabpage?

Richard


On Mon, 1 Aug 2005 06:55:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsout h.net> wrote:
Hi,

Here a link on how to bind a control to a datasource.
http://msdn.microsoft.com/library/de...dingstopic.asp

VB.net does not update the info in bound controls until they are
shown. Since all the tabpages are not visible when the form is loaded the
controls on those tabpages will not contain data until they are shown.

Ken
-----------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:n3******* *************** **********@4ax. com...
I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
information about a particular Seller and is read from a
SellerDatavi ew at form load.

On Tabpages 2-7, the information comes from another table/another
DealDataview .

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard



Nov 21 '05 #3
Hi Ken,

I've spent another day on this but am really not getting very far.

My databinding is fine. If I move one of the text boxes to the main
form, the data displays as usual. But as soon as they are on the
tabpage, I am unable to get the tabpages to display any data
whatsoever from the dataset.

So the problem must be getting the tabpage to display the information,
or at least getting the tabpage to allow proper binding. No
exceptions are thrown up but there is no data.

I have tried setting the binding context of each page to the form. I
have tried making each page visiible before binding. And I have tried
showing each form before doing the actual binding.

All to no avail. What am I doing wrong?
Richard

On Mon, 1 Aug 2005 06:55:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsout h.net> wrote:
Hi,

Here a link on how to bind a control to a datasource.
http://msdn.microsoft.com/library/de...dingstopic.asp

VB.net does not update the info in bound controls until they are
shown. Since all the tabpages are not visible when the form is loaded the
controls on those tabpages will not contain data until they are shown.

Ken
-----------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:n3******* *************** **********@4ax. com...
I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
information about a particular Seller and is read from a
SellerDatavi ew at form load.

On Tabpages 2-7, the information comes from another table/another
DealDataview .

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard



Nov 21 '05 #4
Hi,

I would have to see some code to find your problem. Here is a
simple example. I have a datagrid and tabcontrol on the form. I added 3
tabpages to the tabcontrol. On tabpage1 I added textbox1, on tabpage2 I
added textbox2, and tabpage3 I added textbox3.

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim strConn As String
Dim strSQL As String
Dim daEmployees As OleDbDataAdapte r
Dim conn As OleDbConnection
Dim ds As New DataSet

strConn = "Provider = Microsoft.Jet.O LEDB.4.0;"
strConn &= "Data Source =C:\Northwind.m db;"

conn = New OleDbConnection (strConn)

daEmployees = New OleDbDataAdapte r("Select * From Products", conn)
daEmployees.Fil l(ds, "Products")

DataGrid1.DataS ource = ds.Tables("Prod ucts")
DataGrid1.DataS ource = ds.Tables("Prod ucts")
ds.Tables("Prod ucts").DefaultV iew.AllowNew = False

TextBox1.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"ProductNam e")
TextBox2.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsInSto ck")
TextBox3.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsOnOrd er")
End Sub
Ken
------------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:0o******** *************** *********@4ax.c om...
Hi Ken,

I've spent another day on this but am really not getting very far.

My databinding is fine. If I move one of the text boxes to the main
form, the data displays as usual. But as soon as they are on the
tabpage, I am unable to get the tabpages to display any data
whatsoever from the dataset.

So the problem must be getting the tabpage to display the information,
or at least getting the tabpage to allow proper binding. No
exceptions are thrown up but there is no data.

I have tried setting the binding context of each page to the form. I
have tried making each page visiible before binding. And I have tried
showing each form before doing the actual binding.

All to no avail. What am I doing wrong?
Richard

On Mon, 1 Aug 2005 06:55:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsout h.net> wrote:
Hi,

Here a link on how to bind a control to a datasource.
http://msdn.microsoft.com/library/de...dingstopic.asp

VB.net does not update the info in bound controls until they are
shown. Since all the tabpages are not visible when the form is loaded the
controls on those tabpages will not contain data until they are shown.

Ken
-----------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:n3******* *************** **********@4ax. com...
I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
information about a particular Seller and is read from a
SellerDatavi ew at form load.

On Tabpages 2-7, the information comes from another table/another
DealDataview .

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard


Nov 21 '05 #5
Here is the code so far.
I have simplified it for readability.

Public Class frmDeals
Inherits System.Windows. Forms.Form
Protected Const SQL_CONNECTION_ STRING As String = _
"Server=CONRAD; " & _
"Database=OTwoS ourcing;" & _
"UID=sa;passwor d=;"

Public strConnection As String = SQL_CONNECTION_ STRING
Private cnnOTwo As SqlConnection
Private cmdAdvertising As SqlCommand, cmdCourseType As SqlCommand
-----------------------------------
Dim objConnection As SqlConnection = New SqlConnection(s trConnection)

Dim objDataAdapter As SqlDataAdapter = New SqlDataAdapter( _
"SELECT * " & _
"FROM Deals " & _
"WHERE SellerID=" & SellerNo & _
" ORDER BY LeadReceivedDat e", objConnection)

Dim objDataSet As DataSet
Dim objDataView As DataView
Dim objCurrencyMana ger As CurrencyManager
------------------------------------
objDataSet = New DataSet
objDataAdapter. Fill(objDataSet , "Deals")
objDataView = New DataView(objDat aSet.Tables("De als"))
objCurrencyMana ger = CType(Me.Bindin gContext(objDat aView),
CurrencyManager )

' Set the binding context for each page to the form's binding
' context

For Each tp As TabPage In tabDeals.TabPag es
tp.BindingConte xt = Me.BindingConte xt
Next
---------------------------------------
' Clear the databindings on each page

For Each tp As TabPage In tabDeals.TabPag es

Select Case tp.Name
Case "tabPropert y"
txtAddress.Data Bindings.Clear( )
Case "tabFinanci al"
txtPrice.DataBi ndings.Clear()
End Select
Next tp

' Bind all textboxes on each page

For Each tp As TabPage In tabDeals.TabPag es

Select Case tp.name

Case "tabPropert y"
tp.Show() ' (also tried tp.visible=true )
txtAddress.Data Bindings.Add("T ext", objDataView,
"Address")

Case "tabFinanci al"
tp.show() ' (also tried tp.visible=true )
txtPrice.Databi ndings.Add("Tex t",objDataView, "Price")
End Select
Next tp
The value for SellerNo is passed to this form from a calling form.
Richard


On Tue, 2 Aug 2005 03:20:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsout h.net> wrote:
Hi,

I would have to see some code to find your problem. Here is a
simple example. I have a datagrid and tabcontrol on the form. I added 3
tabpages to the tabcontrol. On tabpage1 I added textbox1, on tabpage2 I
added textbox2, and tabpage3 I added textbox3.

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventAr gs) Handles MyBase.Load
Dim strConn As String
Dim strSQL As String
Dim daEmployees As OleDbDataAdapte r
Dim conn As OleDbConnection
Dim ds As New DataSet

strConn = "Provider = Microsoft.Jet.O LEDB.4.0;"
strConn &= "Data Source =C:\Northwind.m db;"

conn = New OleDbConnection (strConn)

daEmployees = New OleDbDataAdapte r("Select * From Products", conn)
daEmployees.Fil l(ds, "Products")

DataGrid1.DataS ource = ds.Tables("Prod ucts")
DataGrid1.DataS ource = ds.Tables("Prod ucts")
ds.Tables("Prod ucts").DefaultV iew.AllowNew = False

TextBox1.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"ProductName ")
TextBox2.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsInStock" )
TextBox3.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsOnOrder" )
End Sub
Ken
------------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:0o******* *************** **********@4ax. com...
Hi Ken,

I've spent another day on this but am really not getting very far.

My databinding is fine. If I move one of the text boxes to the main
form, the data displays as usual. But as soon as they are on the
tabpage, I am unable to get the tabpages to display any data
whatsoever from the dataset.

So the problem must be getting the tabpage to display the information,
or at least getting the tabpage to allow proper binding. No
exceptions are thrown up but there is no data.

I have tried setting the binding context of each page to the form. I
have tried making each page visiible before binding. And I have tried
showing each form before doing the actual binding.

All to no avail. What am I doing wrong?
Richard

On Mon, 1 Aug 2005 06:55:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsou th.net> wrote:
Hi,

Here a link on how to bind a control to a datasource.
http://msdn.microsoft.com/library/de...dingstopic.asp

VB.net does not update the info in bound controls until they are
shown. Since all the tabpages are not visible when the form is loaded the
controls on those tabpages will not contain data until they are shown.

Ken
-----------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:n3****** *************** ***********@4ax .com...
I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
information about a particular Seller and is read from a
SellerDatavie w at form load.

On Tabpages 2-7, the information comes from another table/another
DealDatavie w.

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard



Nov 21 '05 #6
Hi,

You dont need to set the binding context for the tabpage = to the
binding context for the form. It will automatically be the same.

Ken
-----------------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:4n******** *************** *********@4ax.c om...
Here is the code so far.
I have simplified it for readability.

Public Class frmDeals
Inherits System.Windows. Forms.Form
Protected Const SQL_CONNECTION_ STRING As String = _
"Server=CONRAD; " & _
"Database=OTwoS ourcing;" & _
"UID=sa;passwor d=;"

Public strConnection As String = SQL_CONNECTION_ STRING
Private cnnOTwo As SqlConnection
Private cmdAdvertising As SqlCommand, cmdCourseType As SqlCommand
-----------------------------------
Dim objConnection As SqlConnection = New SqlConnection(s trConnection)

Dim objDataAdapter As SqlDataAdapter = New SqlDataAdapter( _
"SELECT * " & _
"FROM Deals " & _
"WHERE SellerID=" & SellerNo & _
" ORDER BY LeadReceivedDat e", objConnection)

Dim objDataSet As DataSet
Dim objDataView As DataView
Dim objCurrencyMana ger As CurrencyManager
------------------------------------
objDataSet = New DataSet
objDataAdapter. Fill(objDataSet , "Deals")
objDataView = New DataView(objDat aSet.Tables("De als"))
objCurrencyMana ger = CType(Me.Bindin gContext(objDat aView),
CurrencyManager )

' Set the binding context for each page to the form's binding
' context

For Each tp As TabPage In tabDeals.TabPag es
tp.BindingConte xt = Me.BindingConte xt
Next
---------------------------------------
' Clear the databindings on each page

For Each tp As TabPage In tabDeals.TabPag es

Select Case tp.Name
Case "tabPropert y"
txtAddress.Data Bindings.Clear( )
Case "tabFinanci al"
txtPrice.DataBi ndings.Clear()
End Select
Next tp

' Bind all textboxes on each page

For Each tp As TabPage In tabDeals.TabPag es

Select Case tp.name

Case "tabPropert y"
tp.Show() ' (also tried tp.visible=true )
txtAddress.Data Bindings.Add("T ext", objDataView,
"Address")

Case "tabFinanci al"
tp.show() ' (also tried tp.visible=true )
txtPrice.Databi ndings.Add("Tex t",objDataView, "Price")
End Select
Next tp
The value for SellerNo is passed to this form from a calling form.
Richard


On Tue, 2 Aug 2005 03:20:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsout h.net> wrote:
Hi,

I would have to see some code to find your problem. Here is a
simple example. I have a datagrid and tabcontrol on the form. I added 3
tabpages to the tabcontrol. On tabpage1 I added textbox1, on tabpage2 I
added textbox2, and tabpage3 I added textbox3.

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventAr gs) Handles MyBase.Load
Dim strConn As String
Dim strSQL As String
Dim daEmployees As OleDbDataAdapte r
Dim conn As OleDbConnection
Dim ds As New DataSet

strConn = "Provider = Microsoft.Jet.O LEDB.4.0;"
strConn &= "Data Source =C:\Northwind.m db;"

conn = New OleDbConnection (strConn)

daEmployees = New OleDbDataAdapte r("Select * From Products", conn)
daEmployees.Fil l(ds, "Products")

DataGrid1.DataS ource = ds.Tables("Prod ucts")
DataGrid1.DataS ource = ds.Tables("Prod ucts")
ds.Tables("Prod ucts").DefaultV iew.AllowNew = False

TextBox1.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"ProductName ")
TextBox2.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsInStock" )
TextBox3.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsOnOrder" )
End Sub
Ken
------------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:0o******* *************** **********@4ax. com...
Hi Ken,

I've spent another day on this but am really not getting very far.

My databinding is fine. If I move one of the text boxes to the main
form, the data displays as usual. But as soon as they are on the
tabpage, I am unable to get the tabpages to display any data
whatsoever from the dataset.

So the problem must be getting the tabpage to display the information,
or at least getting the tabpage to allow proper binding. No
exceptions are thrown up but there is no data.

I have tried setting the binding context of each page to the form. I
have tried making each page visiible before binding. And I have tried
showing each form before doing the actual binding.

All to no avail. What am I doing wrong?
Richard

On Mon, 1 Aug 2005 06:55:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsou th.net> wrote:
Hi,

Here a link on how to bind a control to a datasource.
http://msdn.microsoft.com/library/de...dingstopic.asp

VB.net does not update the info in bound controls until they are
shown. Since all the tabpages are not visible when the form is loaded the
controls on those tabpages will not contain data until they are shown.

Ken
-----------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:n3****** *************** ***********@4ax .com...
I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
information about a particular Seller and is read from a
SellerDatavie w at form load.

On Tabpages 2-7, the information comes from another table/another
DealDatavie w.

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard


Nov 21 '05 #7
Okay,

Thank you for this Ken. I'm amost there. I have stripped away all
the coding that was referring to a specific tab page.

What was causing the problem was to do with how I opened the form
specifying the records that the sqldataadapter should load.

On opening the main (opening) form of my project I am creating
instances of all the forms.

On my Deals form (the form with the tabpages) I've created a public
property SellerNo which is set from the Seller form to display all
Deals by a particular seller when I actually open the Deals Form (the
class of which is already loaded at startup remember).

It seems though that because I had already loaded the form at startup,
the sqldataadapter had already loaded the valid records (i.e. where
the SellerID was null, rather than when SellerID=7) and was therefore
ignoring my new request to load it again.

I was calling the Deals form from this button on the Sellers Form

Dim cfrmDeals As New frmDeals
cfrmDeals.Selle rNo = Convert.ToInt32 (txtSellerID.Te xt)
cfrmDeals.Visib le = True
cfrmDeals.Activ ate()

I am using a multi-form application, and one which I was creating new
instances of each form on loading my main form
i.e.

cfrmSwitchboard = Me
cfrmSellers = New frmSellers
cfrmDeals = New frmDeals

Hope this is clear.

Is there another way to do what I was looking to do?

Richard

On Tue, 2 Aug 2005 20:36:33 -0400, "Ken Tucker [MVP]"
<vb***@bellsout h.net> wrote:
Hi,

You dont need to set the binding context for the tabpage = to the
binding context for the form. It will automatically be the same.

Ken
-----------------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:4n******* *************** **********@4ax. com...
Here is the code so far.
I have simplified it for readability.

Public Class frmDeals
Inherits System.Windows. Forms.Form
Protected Const SQL_CONNECTION_ STRING As String = _
"Server=CONRAD; " & _
"Database=OTwoS ourcing;" & _
"UID=sa;passwor d=;"

Public strConnection As String = SQL_CONNECTION_ STRING
Private cnnOTwo As SqlConnection
Private cmdAdvertising As SqlCommand, cmdCourseType As SqlCommand
-----------------------------------
Dim objConnection As SqlConnection = New SqlConnection(s trConnection)

Dim objDataAdapter As SqlDataAdapter = New SqlDataAdapter( _
"SELECT * " & _
"FROM Deals " & _
"WHERE SellerID=" & SellerNo & _
" ORDER BY LeadReceivedDat e", objConnection)

Dim objDataSet As DataSet
Dim objDataView As DataView
Dim objCurrencyMana ger As CurrencyManager
------------------------------------
objDataSet = New DataSet
objDataAdapter .Fill(objDataSe t, "Deals")
objDataView = New DataView(objDat aSet.Tables("De als"))
objCurrencyMan ager = CType(Me.Bindin gContext(objDat aView),
CurrencyManage r)

' Set the binding context for each page to the form's binding
' context

For Each tp As TabPage In tabDeals.TabPag es
tp.BindingConte xt = Me.BindingConte xt
Next
---------------------------------------
' Clear the databindings on each page

For Each tp As TabPage In tabDeals.TabPag es

Select Case tp.Name
Case "tabPropert y"
txtAddress.Data Bindings.Clear( )
Case "tabFinanci al"
txtPrice.DataBi ndings.Clear()
End Select
Next tp

' Bind all textboxes on each page

For Each tp As TabPage In tabDeals.TabPag es

Select Case tp.name

Case "tabPropert y"
tp.Show() ' (also tried tp.visible=true )
txtAddress.Data Bindings.Add("T ext", objDataView,
"Address")

Case "tabFinanci al"
tp.show() ' (also tried tp.visible=true )
txtPrice.Databi ndings.Add("Tex t",objDataView, "Price")
End Select
Next tp
The value for SellerNo is passed to this form from a calling form.
Richard


On Tue, 2 Aug 2005 03:20:24 -0400, "Ken Tucker [MVP]"
<vb***@bellsou th.net> wrote:
Hi,

I would have to see some code to find your problem. Here is a
simple example. I have a datagrid and tabcontrol on the form. I added 3
tabpages to the tabcontrol. On tabpage1 I added textbox1, on tabpage2 I
added textbox2, and tabpage3 I added textbox3.

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventA rgs) Handles MyBase.Load
Dim strConn As String
Dim strSQL As String
Dim daEmployees As OleDbDataAdapte r
Dim conn As OleDbConnection
Dim ds As New DataSet

strConn = "Provider = Microsoft.Jet.O LEDB.4.0;"
strConn &= "Data Source =C:\Northwind.m db;"

conn = New OleDbConnection (strConn)

daEmployees = New OleDbDataAdapte r("Select * From Products", conn)
daEmployees.Fil l(ds, "Products")

DataGrid1.DataS ource = ds.Tables("Prod ucts")
DataGrid1.DataS ource = ds.Tables("Prod ucts")
ds.Tables("Prod ucts").DefaultV iew.AllowNew = False

TextBox1.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"ProductName" )
TextBox2.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsInStock ")
TextBox3.DataBi ndings.Add("Tex t", ds.Tables("Prod ucts"),
"UnitsOnOrder ")
End Sub
Ken
------------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:0o****** *************** ***********@4ax .com...
Hi Ken,

I've spent another day on this but am really not getting very far.

My databinding is fine. If I move one of the text boxes to the main
form, the data displays as usual. But as soon as they are on the
tabpage, I am unable to get the tabpages to display any data
whatsoever from the dataset.

So the problem must be getting the tabpage to display the information,
or at least getting the tabpage to allow proper binding. No
exceptions are thrown up but there is no data.

I have tried setting the binding context of each page to the form. I
have tried making each page visiible before binding. And I have tried
showing each form before doing the actual binding.

All to no avail. What am I doing wrong?
Richard

On Mon, 1 Aug 2005 06:55:24 -0400, "Ken Tucker [MVP]"
<vb***@bellso uth.net> wrote:
Hi,

Here a link on how to bind a control to a datasource.
http://msdn.microsoft.com/library/de...dingstopic.asp

VB.net does not update the info in bound controls until they are
shown. Since all the tabpages are not visible when the form is loaded the
controls on those tabpages will not contain data until they are shown.

Ken
-----------------
"Richard" <xx************ ******@yahoo.co .uk> wrote in message
news:n3***** *************** ************@4a x.com...
I have a form with seven tapages. These span only one record with a
large number of fields (textboxes).

On Tabpage1 I display a number of read-only text boxes. This displays
informatio n about a particular Seller and is read from a
SellerDatavi ew at form load.

On Tabpages 2-7, the information comes from another table/another
DealDataview .

What I want is the user to scroll through the records which will
affect only Tabpages 2-7.

My problem is that at load, none of the information from any of the
tabpages displays data. Only on debug do the textboxes read that data
is written to them (Tabpage1), but this data never displays on the
actual form. For tabpages 2-7, nothing seems to be written at all.

I understand that I may need to manually set the binding context of
each tabpage to the form's binding context, but as I am working iwth
two dataviews, I'm a little confused.

HELP?!!


Richard



Nov 21 '05 #8

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

Similar topics

8
3740
by: Alexia | last post by:
Hi, I wanted to know how i can make the title that is displayed in a tabpage bold when it is selected. I have 4 tabpages and i want the user to know more clearly which one is selected. I tried to do this but for some reason all the text on that particular page turns bold. Can any one give me some pointers?
0
1067
by: Thanos | last post by:
Hi everybody. Excuse my english is not perfect. I would to hide TabPages but I have tried >> TabPage.hide() or >> TabPage.Visible = False but no luck. Maybe the current Tab control doesn't support hiding/unhiding
2
1676
by: JG | last post by:
Hi, I have a windows form with a TabControl on it. It has 3 tabpages on it. I have also coded a button that is supposed to 'add' a new tabpage. The code in that clicked event looks like this: tabPage tpNew = new TabPage("TabPage4"); this.tabControl1.TabPages.Add(tpNew); tpNew.Controls.Add(this.label1);
4
5916
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a single RichTextBox on each page. In my controls loaded event I call my Render() method which configures everything appropriately. When setting up the...
1
2724
by: Luc | last post by:
Hi, I have a TabControl and, at runtime, I need to add some tabpages. The problem is that each tabpage is similar to the others and contains several controls. If I do TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is added. How can I add in few statements a new tabpage as well as its controls (textboxes, labels, etc.)? The first...
3
4840
by: VJ | last post by:
Is there a way to Order Tabpages.. I tried to Use a Class that implements the IComparer and a Compare method as suggested in the MSDN article. "ArrayList.Sort()" and then use the instance of this class to sort like.. tbControl.TabPages.Sort(lstSorter) There seems to be no effect..... I have tried debugging, the sorting seems to...
2
1688
by: Kevin | last post by:
Although lots of people described how to workaround the lack of ability to hide and show tab pages on a tab control, I couldnt find a code example so I made one. Create a class that inherits from the tabcontrol and then add the following Private htVisibleVal As New Hashtable Private htVisibleKey As New Hashtable Private htInvisibleKey As...
11
18098
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with ListView columns so it should be doable, thanks
7
5567
by: davidpryce123 | last post by:
Dear Windows Form Designers I am developing an application that uses a TabControl with several Tabpages. On the different Tabpages I wish to allow users to have the access to the same controls for instance a textbox to enter a date and time string for search.
0
7837
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...
0
8097
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. ...
0
8268
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...
1
7852
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...
0
8133
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...
0
3770
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...
0
3791
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2268
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
1
1366
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.