TabControl behaves erratically

robertb_NZ

Well-known member
Joined
May 11, 2010
Messages
146
Location
Auckland, New Zealand
Programming Experience
10+
I have a tab control with 4 tabs: let's call them Tab0, Tab1, Tab2, and Tab3. When the form is opened Tab0 is displayed. If I click Tab1 or Tab3 they display normally, but if I click Tab2 Tab0 remains displayed although the tab itself (at the top) shows as Tab2. If I now click Tab0 and then Tab2 again, it now displays properly. It also displays properly if I click Tab3 and then Tab2, but not if I click Tab1 and then Tab2. Once it is displaying correctly, it continues to display correctly whenever Tab2 is clicked until the form is closed.

In researching this problem I added this code: -
Private Sub TabControl1_Selected(sender As Object, e As System.Windows.Forms.TabControlEventArgs) Handles TabControl1.Selected
Debug.Print("Selected " & TabControl1.SelectedIndex)​
End Sub
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
Debug.Print("Changed " & TabControl1.SelectedIndex)​
End Sub​

For tabs 0, 1, and 3, and when Tab2 is correctly displayed both debug messages appear. When Tab2 is incorrectly displayed only the "Selected" message appears.

I am using VS2010 and VB.NET 4.0.

Any ideas on how I solve this problem?

Thank you, Robert.
 
Generally speaking, I consider uploading a whole project to be a last resort but this sounds like a very specific problem so I'd suggest zipping up your whole solution, after deleting any bin and obj folders, and attaching it to a post so we can test it out for ourselves.
 
OK, thanks. I'll prepare an abbreviated version of the project because 99% of the code will be irrelevant to this problem. If the problem disappears in my abbreviated version then that will tell us something. I'll post again when I've done this.
 
Project files attached

Here's a cut down version of my project: I've eviscerated the parser and code generator, and removed FTP, so it's a lot smaller. The problem is still evident: -
1. Start the project up with Visual Studio (I'm using 2010). It should display the workbench, probably with a blank program area, and many buttons won't do anything.
2. Click [Configure] This will display the configuration screen, with the first tab (Workbench Options) displayed.
3. To see the error: click the z/OS tab and look at the result. Then click Workbench Options and then z/OS again. Now the z/OS tab is displayed properly.

There might be some errors in this tab - Port nbr not numeric, etc. You can use IP 123.123.123.123 and Port 21 to get past these errors (FTP has been removed so these values don't matter anyway).

Let me know if there are any problems with the zip. I hope I haven't left anything out that you need.

Thanks very much for offering to help,

Regards, Robert Barnes.
 
I have removed your attachment because you failed to do as I specifically asked and delete the bin and obj folders first. Those folders contain the compiled binaries and uploading executable files is against forum rules.
 
Uploaded project

Oops sorry. Here's another version, this should be OK because this time I deleted the /bin and /obj folders with Windows Explorer before I zipped it.
 

Attachments

  • JazzProblem.zip
    379.1 KB · Views: 12
In Configure form there is an error in control bindings, form generated source code for TextBox8 adds to DataBindings MySettings "JCL", where it should be "JCLLib", while initial text is correctly set from MySettings.Default.JCLLib.
Because of this, selecting z/Os tab would for me throw an exception "Cannot bind to the property or column JCL on the DataSource" since there is no JCL setting.
 
Back
Top