3 Replies - 1225 Views - Last Post: 26 June 2008 - 12:01 PM Rate Topic: -----

#1 Tomaso48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 01-June 08

An Odd TabControl Problem

Posted 25 June 2008 - 11:17 AM

I have a form which has 3 TabControl controls on it. Each TabControl has a number of Tabs. Depending on options selected before loading the form, one of the TabControls will be activated and visible. The other two TabControls will have their Visible property set to False. Here is the code for making TabControl1 visible that I am using. There is the same code for TabControls 2 & 3:

			   If MbrId > 0 Then
					Me.TabControl1.Visible = True
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = False
				Else
					Me.TabControl1.Visible = False
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = False
				End If
 


When I run the form, expecting TabControl1 or TabControl2 to be visible, they are. However, when TabControl3 should be visible it isn't. When I step through the code, it executes the
Me.TabControl3.Visible = True
line, but when I check the property it is still set to False.

Needless to say, this is becoming very frustrating. Does anyone have any ideas on this?

Thanks in advance,
Tom

Is This A Good Question/Topic? 0
  • +

Replies To: An Odd TabControl Problem

#2 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: An Odd TabControl Problem

Posted 25 June 2008 - 12:47 PM

There must be somewhere else in the code after that that it is becoming invisible again. Also, it would be helpful if you posted your entire form load event, and not just a segment, that way i could see exactly what is happening.
Was This Post Helpful? 0
  • +
  • -

#3 Tomaso48  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 01-June 08

Re: An Odd TabControl Problem

Posted 26 June 2008 - 08:04 AM

Thanks, Jordan. This is all handled in a PreLoad and the complete code is listed below. I tried moving it all into the Load but still had the same result. I cut the TabControls from the form and then pasted them back. This fixed 1 & 2, but TabControl3 still will not show, even when I expressly set the Visible property to True.

 Public Overrides Sub preLoad()

		Dim formloads As New DCCds.formLoads
		Select Case My.Application.depApps.lcapp
			Case 1
				DCCList.Close()
				'MbrId = DCCList.lnMbrId
				Me.appLabel.Text = "DCC"
				If MbrId > 0 Then
					Me.TabControl1.Visible = True
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = False
				Else
					Me.TabControl1.Visible = False
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = False
				End If
				Me.CheckBox4.Enabled = True
				Me.CheckBox13.Enabled = True
				Me.CheckBox5.Enabled = True
				Me.CheckBox6.Enabled = True
				Me.CheckBox7.Enabled = True
				Me.CheckBox8.Enabled = True
				Me.CheckBox14.Enabled = True
				Me.CheckBox15.Enabled = True
				Me.CheckBox4.Checked = False
				Me.CheckBox8.Checked = False
				Me.CheckBox14.Checked = False
				Me.Label11.Visible = False
				Me.Label12.Visible = False
				Me.planComboBox.Visible = False
				Me.prodComboBox.Visible = False
				Me.planComboBox.Enabled = False
				Me.prodComboBox.Enabled = False
				'Set up tables
				formloads.dcc(Me.dccDS, MbrId, 1)
			Case 2
				CodaPPDList.Hide()
				Me.appLabel.Text = "CODA"

				If MbrId > 0 Then
					Me.TabControl1.Visible = False
					Me.TabControl2.BringToFront()
					Me.TabControl2.Visible = True
					Me.TabControl3.Visible = False
				Else
					Me.TabControl1.Visible = False
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = False
				End If
				Me.CheckBox4.Enabled = False
				Me.CheckBox13.Enabled = False
				Me.CheckBox5.Enabled = False
				Me.CheckBox6.Enabled = False
				Me.CheckBox7.Enabled = False
				Me.CheckBox8.Enabled = False
				Me.CheckBox14.Enabled = True
				Me.CheckBox15.Enabled = True
				Me.CheckBox4.Checked = False
				Me.CheckBox8.Checked = False
				Me.CheckBox14.Checked = False
				Me.Label11.Visible = True
				Me.Label12.Visible = True
				Me.planComboBox.Visible = True
				Me.prodComboBox.Visible = True
				Me.planComboBox.Enabled = True
				Me.prodComboBox.Enabled = True

				formloads.dcc(Me.dccDS, MbrId, 2)
			Case 3
				CodaPPDList.Hide()
				Me.appLabel.Text = "MDP"

				If MbrId > 0 Then
					Me.TabControl1.Visible = False
					Me.TabControl2.Visible = True
					Me.TabControl3.Visible = False
				Else
					Me.TabControl1.Visible = False
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = False
				End If

				Me.CheckBox4.Enabled = False
				Me.CheckBox13.Enabled = False
				Me.CheckBox5.Enabled = False
				Me.CheckBox6.Enabled = False
				Me.CheckBox7.Enabled = False
				Me.CheckBox8.Enabled = False
				Me.CheckBox14.Enabled = True
				Me.CheckBox15.Enabled = True
				Me.CheckBox4.Checked = False
				Me.CheckBox8.Checked = False
				Me.CheckBox14.Checked = False
				Me.Label11.Visible = True
				Me.Label12.Visible = True
				Me.planComboBox.Visible = True
				Me.prodComboBox.Visible = True
				Me.planComboBox.Enabled = True
				Me.prodComboBox.Enabled = True
			Case 4
				If BPTasks.lnMbrId = 0 Then
					BPTasks.Hide()
					If BPList.lnMbrId = 0 Then
						BPList.Hide()
					Else
						MbrId = BPList.lnMbrId
					End If
				Else
					MbrId = BPTasks.lnMbrId
				End If

				Me.appLabel.Text = "BPDM"
				If MbrId > 0 Then
					Me.TabControl1.Visible = False
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = True
					Me.TabControl3.Visible = True
				Else
					Me.TabControl1.Visible = False
					Me.TabControl2.Visible = False
					Me.TabControl3.Visible = True
					Me.TabControl3.BringToFront()
				End If

				Me.CheckBox4.Enabled = False
				Me.CheckBox13.Enabled = False
				Me.CheckBox5.Enabled = False
				Me.CheckBox6.Enabled = False
				Me.CheckBox7.Enabled = False
				Me.CheckBox8.Enabled = False
				Me.CheckBox14.Enabled = False
				Me.CheckBox15.Enabled = False
				Me.CheckBox1.Enabled = False
				Me.CheckBox10.Enabled = False
				Me.CheckBox2.Enabled = False
				Me.CheckBox11.Enabled = False
				Me.CheckBox3.Enabled = False
				Me.CheckBox12.Enabled = False
				Me.CheckBox4.Checked = False
				Me.CheckBox8.Checked = False
				Me.CheckBox14.Checked = False
				Me.GroupBox1.Visible = False
				Me.GroupBox2.Visible = False
				Me.WpLabel1.Visible = False
				Me.NotewbhNotes.Visible = False
				Me.Label11.Visible = False
				Me.Label12.Visible = False
				Me.planComboBox.Visible = False
				Me.prodComboBox.Visible = False
				Me.planComboBox.Enabled = False
				Me.prodComboBox.Enabled = False

				formloads.dcc(Me.dccDS, MbrId, 4)
				Me.ResoListBindingSource.Filter = "key_type = 'coord'"
				Me.ResoListBindingSource.Sort = "int_order"
		End Select
  


	End Sub 

Was This Post Helpful? 0
  • +
  • -

#4 jacobjordan  Icon User is offline

  • class Me : Perfection
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,499
  • Joined: 11-June 08

Re: An Odd TabControl Problem

Posted 26 June 2008 - 12:01 PM

You have quite a bit of code here. To make it easier for both of us to see what is happening, i marked every line where the visibility of tabcontrol3 could be altered.

Public Overrides Sub preLoad()

        Dim formloads As New DCCds.formLoads
        Select Case My.Application.depApps.lcapp
            Case 1
                DCCList.Close()
                'MbrId = DCCList.lnMbrId
                Me.appLabel.Text = "DCC"
                If MbrId > 0 Then
                    Me.TabControl1.Visible = True
                    Me.TabControl2.Visible = False
                    Me.TabControl3.Visible = False '<<<<<<<<
                Else
                    Me.TabControl1.Visible = False
                    Me.TabControl2.Visible = False
                    Me.TabControl3.Visible = False '<<<<<<<<
                End If
                Me.CheckBox4.Enabled = True
                Me.CheckBox13.Enabled = True
                Me.CheckBox5.Enabled = True
                Me.CheckBox6.Enabled = True
                Me.CheckBox7.Enabled = True
                Me.CheckBox8.Enabled = True
                Me.CheckBox14.Enabled = True
                Me.CheckBox15.Enabled = True
                Me.CheckBox4.Checked = False
                Me.CheckBox8.Checked = False
                Me.CheckBox14.Checked = False
                Me.Label11.Visible = False
                Me.Label12.Visible = False
                Me.planComboBox.Visible = False
                Me.prodComboBox.Visible = False
                Me.planComboBox.Enabled = False
                Me.prodComboBox.Enabled = False
                'Set up tables
                formloads.dcc(Me.dccDS, MbrId, 1)
            Case 2
                CodaPPDList.Hide()
                Me.appLabel.Text = "CODA"

                If MbrId > 0 Then
                    Me.TabControl1.Visible = False
                    Me.TabControl2.BringToFront()
                    Me.TabControl2.Visible = True
                    Me.TabControl3.Visible = False '<<<<<<<<
                Else
                    Me.TabControl1.Visible = False
                    Me.TabControl2.Visible = False
                    Me.TabControl3.Visible = False '<<<<<<<<
                End If
                Me.CheckBox4.Enabled = False
                Me.CheckBox13.Enabled = False
                Me.CheckBox5.Enabled = False
                Me.CheckBox6.Enabled = False
                Me.CheckBox7.Enabled = False
                Me.CheckBox8.Enabled = False
                Me.CheckBox14.Enabled = True
                Me.CheckBox15.Enabled = True
                Me.CheckBox4.Checked = False
                Me.CheckBox8.Checked = False
                Me.CheckBox14.Checked = False
                Me.Label11.Visible = True
                Me.Label12.Visible = True
                Me.planComboBox.Visible = True
                Me.prodComboBox.Visible = True
                Me.planComboBox.Enabled = True
                Me.prodComboBox.Enabled = True

                formloads.dcc(Me.dccDS, MbrId, 2)
            Case 3
                CodaPPDList.Hide()
                Me.appLabel.Text = "MDP"

                If MbrId > 0 Then
                    Me.TabControl1.Visible = False
                    Me.TabControl2.Visible = True
                    Me.TabControl3.Visible = False '<<<<<<<<
                Else
                    Me.TabControl1.Visible = False
                    Me.TabControl2.Visible = False
                    Me.TabControl3.Visible = False '<<<<<<<<
                End If

                Me.CheckBox4.Enabled = False
                Me.CheckBox13.Enabled = False
                Me.CheckBox5.Enabled = False
                Me.CheckBox6.Enabled = False
                Me.CheckBox7.Enabled = False
                Me.CheckBox8.Enabled = False
                Me.CheckBox14.Enabled = True
                Me.CheckBox15.Enabled = True
                Me.CheckBox4.Checked = False
                Me.CheckBox8.Checked = False
                Me.CheckBox14.Checked = False
                Me.Label11.Visible = True
                Me.Label12.Visible = True
                Me.planComboBox.Visible = True
                Me.prodComboBox.Visible = True
                Me.planComboBox.Enabled = True
                Me.prodComboBox.Enabled = True
            Case 4
                If BPTasks.lnMbrId = 0 Then
                    BPTasks.Hide()
                    If BPList.lnMbrId = 0 Then
                        BPList.Hide()
                    Else
                        MbrId = BPList.lnMbrId
                    End If
                Else
                    MbrId = BPTasks.lnMbrId
                End If

                Me.appLabel.Text = "BPDM"
                If MbrId > 0 Then
                    Me.TabControl1.Visible = False
                    Me.TabControl2.Visible = False
                    Me.TabControl3.Visible = True '<<<<<<<<
                    Me.TabControl3.Visible = True '<<<<<<<<
                Else
                    Me.TabControl1.Visible = False
                    Me.TabControl2.Visible = False
                    Me.TabControl3.Visible = True '<<<<<<<<
                    Me.TabControl3.BringToFront()
                End If

                Me.CheckBox4.Enabled = False
                Me.CheckBox13.Enabled = False
                Me.CheckBox5.Enabled = False
                Me.CheckBox6.Enabled = False
                Me.CheckBox7.Enabled = False
                Me.CheckBox8.Enabled = False
                Me.CheckBox14.Enabled = False
                Me.CheckBox15.Enabled = False
                Me.CheckBox1.Enabled = False
                Me.CheckBox10.Enabled = False
                Me.CheckBox2.Enabled = False
                Me.CheckBox11.Enabled = False
                Me.CheckBox3.Enabled = False
                Me.CheckBox12.Enabled = False
                Me.CheckBox4.Checked = False
                Me.CheckBox8.Checked = False
                Me.CheckBox14.Checked = False
                Me.GroupBox1.Visible = False
                Me.GroupBox2.Visible = False
                Me.WpLabel1.Visible = False
                Me.NotewbhNotes.Visible = False
                Me.Label11.Visible = False
                Me.Label12.Visible = False
                Me.planComboBox.Visible = False
                Me.prodComboBox.Visible = False
                Me.planComboBox.Enabled = False
                Me.prodComboBox.Enabled = False

                formloads.dcc(Me.dccDS, MbrId, 4)
                Me.ResoListBindingSource.Filter = "key_type = 'coord'"
                Me.ResoListBindingSource.Sort = "int_order"
        End Select
  


    End Sub 



There seems to be only a few time tabcontrol3.visible is set to true. First, make sure when you run the application My.Application.depApps.lcapp has a value of 4. That should make your tabcontrol3 visible when the form is loaded. If it still isn't, then there is something happening elsewhere in your code. It might help if you put breakpoints on your entire load event, that way you can see exactly what is going on when you run it.

I assume your using vb.net, so make sure that your InitializeComponents() sub has ran before you execute this code, or it might as well not be there.

This post has been edited by jacobjordan: 26 June 2008 - 12:05 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1