Tab control

Cereldine

Registered User.
Local time
Today, 23:59
Joined
Aug 4, 2005
Messages
71
Hi, i have a tab control on my page, below it i have a text box. I would like the text box text to change depending on which tab the user is pointing at.

I guess its something to do with the page index property. How do i refererence this in my code?
the only relevant code ive seen is

Me.taboptions.Pages(1).SetFocus

(tabInterface being the controls name) i dont think this is quite what i need. Any ideas welcome
 
Hi Cereldine, I did a demo for you...see attachment.
 

Attachments

i have found another way to do what i was asking for, it is

Public Sub tab_options()

Dim strindex As String
strindex = Me.tabOptions.Value() '' this code gets the value from the tabpage in focus
TextMessage.SetFocus '' need this to set the focus to the textbox,

Select Case strindex

Case "0":
TextMessage.Text = strindex & " employee"
Me.chkEmployee.Visible = True
Me.chkAddress.Visible = False
Me.chkemployment.Visible = False

Case "1"
TextMessage.Text = strindex & " address"
Me.chkAddress.Visible = True
Me.chkEmployee.Visible = False
Me.chkemployment.Visible = False

Case "2"
TextMessage.Text = strindex & " details"
Me.chkemployment.Visible = True
Me.chkEmployee.Visible = False
Me.chkAddress.Visible = False


End Select
End Sub
 
I expect there would be less overhead if you used an integer rather than a string for the value, so something like this

Code:
Dim strindex As Integer
strindex = Me.tabOptions.Value() '' this code gets the value from the tabpage in focus
TextMessage.SetFocus '' need this to set the focus to the textbox,

Select Case strindex

Case 0:
TextMessage.Text = strindex & " employee"
Me.chkEmployee.Visible = True
Me.chkAddress.Visible = False
Me.chkemployment.Visible = False

Case 1
TextMessage.Text = strindex & " address"
Me.chkAddress.Visible = True
Me.chkEmployee.Visible = False
Me.chkemployment.Visible = False

Case 2
TextMessage.Text = strindex & " details"
Me.chkemployment.Visible = True
Me.chkEmployee.Visible = False
Me.chkAddress.Visible = False

End Select
End Sub

This is more a style thing, but becomes important in languages that have stricter types than vb does, so is generally a good habit to get into.
 

Users who are viewing this thread

Back
Top Bottom