473,772 Members | 2,564 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TabControl tab page requires focus to update?

Im using VS 2005.

I have a form with a tab control. I have text boxes which are bound to a
binding source, which is bound to a dataset.

I have a button on the form that allows the user to add a new record. On
clicking the button, i add a new record to the binding source.

i then wanted to update a number of the textboxes with a default value. At
first I was just using a recursive function to loop through each control and
update the textbox to "0.00". However, I found that only the tabpage that
had focus and the previous page would display the values. That is, If I
selected the second tab, then hit the add new record button, every text box
on the first and second tab would display correctly, however the third would
not. I stepped through the code, the code was assigning a value but it would
not appear.

I have managed to get around the problem by selecting each tab as I update
it, but I was just wondering if I am doing something incorrectly or there is
a better way?

I am using the code below.

thanks

Private Sub SetDefaultValue s()
Try
Me.cboAgreement .SelectedValue = 1

For Each myTabPage As TabPage In Me.TabControl1. TabPages
'For some strange reason, values will not appear unless the
tab
'page is currently selected
TabControl1.Sel ectedTab = myTabPage
SetTextControls ToZero(myTabPag e)
Next
TabControl1.Sel ectedIndex = 0
txtFTFirstHours .Focus()
Catch ex As Exception

End Try
End Sub
Private Sub SetTextControls ToZero(ByVal Page As Control)

Try
For Each ctrl As Control In Page.Controls
Select Case TypeName(ctrl)
Case "TextBox"
If CType(ctrl, TextBox).Name <>
"txtClassificat ionDesc" Then
CType(ctrl, TextBox).Text = "0.00"
End If
Case Else
If ctrl.Controls.C ount 0 Then
SetTextControls ToZero(ctrl)
End If
End Select
Next
Catch ex As Exception

End Try
End Sub
Dec 8 '06 #1
0 1445

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

Similar topics

3
420
by: M O J O | last post by:
Hi, Maybe this question has been asked before, but I've searched the net without finding any answer. I create a new solution, put a TabControl on Form1, create a TabPage and a put a TextBox in this TabPage. I run the project and the TextBox does not have focus. :o(
2
2556
by: Steve Amey | last post by:
Hi all I want to be able to prevent a particular tab from being selected at run-time, how would I go about doing that? At the moment, I have created a custom control and inherited the TabControl. I then override the WndProc method and trap the WM_NCHITTEST message (I don't know if this is the correct message to watch out for). I need to check to see if the tab that they are clicking on is Enabled or
1
2435
by: (Pete Cresswell) | last post by:
TabControl on the right side of a form with two tabs: Tab #1 contains two subforms that show some dynamic query results. Tab #2 contains a ListView that gets dynamically populated as the user navigates a TreeView on the left side of the form. The first time I load the ListView, if the tab containing it is not selected (i.e. the ListView is not visible) the screen draws the ListView's contents in the upper left portion of the form -...
1
2575
by: cfyam | last post by:
How can I to disable some tabpages in TabControl, then user cann't select these pages?
7
1838
by: jaYPee | last post by:
i have a tabcontrol in my form and i have a datagrid in tab2 and want to validate the data in tab1 before the user can encode data in datagrid. i set the the datagrid1_enter event to something like this: Private Sub DataGrid1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.Enter If IDNo.Text = "" Then MessageBox.Show("Enter students idno information before entering school year and semester.")
2
3440
by: michael sorens | last post by:
After extensive searching of the docs, I find no mention of support for Ctrl-Tab and Ctrl-Shift-Tab to navigate among tabs in a TabControl. I am surprised that such a common/standard keyboard navigation is not provided. Or am I just missing it...?
1
1475
by: sklett | last post by:
I want to implement a simple form element focus script that will change the color of a form element when it gets focus and revert back when it loses focus. I've got the code working (simple) but now I need to add it to ALL my form controls and there are tons. Is there a way to override page rendering and insert the javascript into the rendered page source? For example, this is what I would like to add to my controls:...
0
1078
by: samadams_2006 | last post by:
Hello, I have a VB.NET Form which has a System.Windows.Forms.TabControl on it. This TabControl has 5 Tabs on it. On each tab, I have various textboxes, option boxes, radio boxes, etc. I would like to have the ability to save the focus on a particular control, so that when I go to another tab, then back to the same tab, the control I left will still be the highlighted control. For example, if I'm on the "City" Textbox on the...
1
3404
by: =?Utf-8?B?TW9oc2luIEtoYW4=?= | last post by:
Hi, I am working on a website where i am creating Horizontal Menus Dynamically from database as per rights available to the user. I have several UserControls. And the Menu control also brings UserControl's URL stored in Database while Page load. There is a TabContainer control below the Menu Control. Now i want to add corresponding UserControl dynamically when user clicks on
0
9454
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
10264
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
10106
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
10039
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
9914
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
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
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
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.