|
-
Nov 15th, 2005, 01:20 AM
#1
Thread Starter
Fanatic Member
whats is the problem with my code?
hi, im having problem with my code
VB Code:
'TabStrip
Private Sub ctlTabs1_TabClick(OldTab As Integer, NewTab As Integer)
If OldTab <> NewTab Then
StatusBar.Panels(1).Text = "BUSY"
pause (300)
Framer(OldTab).Visible = False
Framer(NewTab).Visible = True
Option1(1).Value = 1
StatusBar.Panels(1).Text = "READY"
End If
End Sub
'TabStrip
Private Sub ctlTabs2_TabClick(OldTab As Integer, NewTab As Integer)
StatusBar.Panels(1).Text = "BUSY"
pause (300)
Me.Caption = "Tab Changed from " & OldTab & " to " & NewTab
Option1(2).Value = 1
StatusBar.Panels(1).Text = "READY"
End Sub
'TabStrip
Private Sub ctlTabs3_TabClick(OldTab As Integer, NewTab As Integer)
StatusBar.Panels(1).Text = "BUSY"
pause (300)
Me.Caption = "Tab Changed from " & OldTab & " to " & NewTab
Option1(3).Value = 1
StatusBar.Panels(1).Text = "READY"
End Sub
'TabStrip
Private Sub ctlTabs4_TabClick(OldTab As Integer, NewTab As Integer)
StatusBar.Panels(1).Text = "BUSY"
pause (300)
Me.Caption = "Tab Changed from " & OldTab & " to " & NewTab
Option1(4).Value = 1
StatusBar.Panels(1).Text = "READY"
End Sub
i have 4 OptionButton, when i click the ctlTabs1 i wan't the Option1(1) is selected, then if i click cltTabs2 i wan't the Option1(2) will become selected.. and so on...
what is the problem with my code?
thanks..
-
Nov 15th, 2005, 02:17 AM
#2
Hyperactive Member
Re: whats is the problem with my code?
Not sure if this is what you want. OK I have a tab control with 4 Tabs and also 4 option buttons. when I click tab1 option1(0) is selected click tab2 options1(1) and so forth
VB Code:
Private Sub TabStrip1_Click()
Option1(TabStrip1.SelectedItem.Index - 1).Value = True
End Sub
Hope that helps. if not upload your example so we can have a look
When your dreams come true.
On error resume pulling hair out.
-
Nov 15th, 2005, 02:34 AM
#3
Re: whats is the problem with my code?
It is not exactly clear how TabClick is being used. There is no such event for the TabStrip control. Are you calling it from the Click event. Regardless try this code.
This assumes the Option1 control array indexes are from 1 to 4 (same as the Tab.Index) instead of the default 0 to 3.
VB Code:
Private Sub Form_Load()
'forces Tabstrip click event to fire
'Tag property is used to contain the index of the previous tab
TabStrip1.Tag = 0
TabStrip1.Tabs(1).Selected = True
End Sub
Private Sub TabStrip1_Click()
Dim lngOldTab As Long
Dim lngNewTab As Long
lngOldTab = TabStrip1.Tag
lngNewTab = TabStrip1.SelectedItem.Index
If lngOldTab <> lngNewTab Then
StatusBar1.Panels(1).Text = "BUSY"
pause (300)
Framer(lngOldTab).Visible = False
Framer(lngNewTab).Visible = True
'set the value of the Option button corresponding to the current Tab t o true
Option1(TabStrip1.SelectedItem.Index).Value = True
Me.Caption = "Tab Changed from " & lngOldTab & " to " & lngNewTab
StatusBar1.Panels(1).Text = "READY"
End If
TabStrip1.Tag = lngNewTab
End Sub
-
Nov 15th, 2005, 07:29 AM
#4
Fanatic Member
Re: whats is the problem with my code?
Here is a shorter way of using the tab strip
Make a tab strip, with as many frames as there are tabs
VB Code:
Private Sub tabstrip_Click()
Dim x As Integer
For x = 0 To Frame.Count - 1
Frame(x).Visible = False
Next x
x = tabstrip.SelectedItem.Index
Frame(x - 1).ZOrder 0
Frame(x - 1).Visible = True
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|