473,386 Members | 1,758 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,386 software developers and data experts.

TabControl & DataBinding

Now, I understand my problem (bugs?) about the Tab Control & dataBinding
1)a simple blank form with tabcontrol , there are 2 pages, pages1 got 3
textboxes (txtShipperNAme,txtJobNo,txtVslName) and one "New" button
2)As Formload, I will fill in the dsInvoice and bind the data
dsSeaExHBL.Clear()
daSeaExHBL.Fill(dsSeaExHBL, "BillLadingHeader")
bmSeaExHBL = Me.BindingContext(dsSeaExHBL, "BillLadingHeader")
Me.txtShipperName.DataBindings.Add("text", dsSeaExHBL,
"BillladingHeader.shippername")
Me.txtVslName.DataBindings.Add("text", dsSeaExHBL,
"BillladingHeader.vesselname")
Me.txtJobNo.Text = ""
3) in New button's click Event,
bmSeaExHBL.EndCurrentEdit()
bmSeaExHBL.AddNew()
4) I start to input the data , then I click the Tab Page2, and then I click
back Tab Page1.
5)Bugs:- txtShipperName & txtVslName 's Text got blank [It seems loss what I
input before]
6) For txtJobNo, the data still remain in TextBox.

What's wrong with Tab Control ???
Thanks
From Agnes

Nov 20 '05 #1
2 4924
It should be a bug: Seems everytime back to page1 cause refreshing databind. Use following code to avoid the situation:

Private Sub txtVslName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtVslName.TextChanged
bmSeaExHBL.EndCurrentEdit()
End Sub
"Agnes" wrote:
Now, I understand my problem (bugs?) about the Tab Control & dataBinding
1)a simple blank form with tabcontrol , there are 2 pages, pages1 got 3
textboxes (txtShipperNAme,txtJobNo,txtVslName) and one "New" button
2)As Formload, I will fill in the dsInvoice and bind the data
dsSeaExHBL.Clear()
daSeaExHBL.Fill(dsSeaExHBL, "BillLadingHeader")
bmSeaExHBL = Me.BindingContext(dsSeaExHBL, "BillLadingHeader")
Me.txtShipperName.DataBindings.Add("text", dsSeaExHBL,
"BillladingHeader.shippername")
Me.txtVslName.DataBindings.Add("text", dsSeaExHBL,
"BillladingHeader.vesselname")
Me.txtJobNo.Text = ""
3) in New button's click Event,
bmSeaExHBL.EndCurrentEdit()
bmSeaExHBL.AddNew()
4) I start to input the data , then I click the Tab Page2, and then I click
back Tab Page1.
5)Bugs:- txtShipperName & txtVslName 's Text got blank [It seems loss what I
input before]
6) For txtJobNo, the data still remain in TextBox.

What's wrong with Tab Control ???
Thanks
From Agnes

Nov 20 '05 #2
Agnes,

I have tried to do your problem, see this sample and tell me after trying
that what is different with what you write and what is the problem or even
this sample solved your problem?.

I used a datatable that I made with one column however that is in my opinion
basicly not different from three columns.

Cor

'sample a form with on that a tabcontrol
'with two tabpages
'on tabpage 1 a textbox and a button
'on tabpage 2 a listbox
'and than pasted in
Private cma As CurrencyManager
Dim dt As DataTable
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
dt = New DataTable
dt.Columns.Add("Name")
For i As Integer = 0 To 1
dt.Rows.Add(dt.NewRow)
Next
dt.Rows(0)(0) = "Agnes"
dt.Rows(1)(0) = "Marina"
'Before only to make a table
cma = CType(BindingContext(dt), CurrencyManager)
Me.TextBox1.DataBindings.Add("text", dt, "Name")
Me.ListBox1.DataSource = dt
Me.ListBox1.DisplayMember = "Name
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
cma.AddNew()
End Sub
Nov 20 '05 #3

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

Similar topics

2
by: LS | last post by:
Does anybody know if (and then HOW!) can I change the background color of a WindowsForms.TabControl control? It doesn't have any "BackgroundColor" property, how could then I change it? Thanx!!
1
by: genc ymeri | last post by:
Hi, I'm running in a strange "problem" .... I'm trying to hide a page in tabcontrol with this command " tabMyPage.Hide();" but it still shows up. Am I missing something ??
1
by: JH | last post by:
I have a tab control in my form. I am trying to create a dynamic pie chart. If I use the following code,it works fine on the main form. this.CreateGraphics().FillPie(brushtargeted,240,200,200, 200,...
1
by: vertigo | last post by:
Hello I have TabControl and some TabPages in it. How can i make active these pages ? (i have button on Page1 and after pressing that button i want to see Page2). Thanx Michal
6
by: eye5600 | last post by:
Is there a cure for the problems using databinding with a DateTimePicker? I find that a) sometimes it works, sometimes it doesn't, and b) it fails silently causing all databinding on the DataSet...
1
by: Vik | last post by:
Concatenation operator & used in the databinding expressions for the datagrid template columns appears as '&' in HTML. It causes an error when opening the pages. I have to replace '&' by '&' each...
2
by: Stan Sainte-Rose | last post by:
Hi guys I have a little problem with the tabcontrol. I add and remove tabpage using the following methods : TabControl1.Controls.Add(tabpagex) TabControl1.Controle.Remove(tapagex) But how...
3
by: Agnes | last post by:
myTab control got 2 pages, in page1, i need to type in customer code, and the customer information will be displayed in page 1 & page2. I am using databinding to move the record position. Before...
2
by: Kalpesh | last post by:
Hello, I am facing a design problem here & need your expert design advice on this. Scenario: I have a class called Vendor - which has several simple attributes like Name, Address etc Now,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...

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.