You already have the TabControl object, so you don't need to reference it via the form – in fact, you don't even need to pass the Form as an argument:
Public Function FormatTabControl(ctlTabControl As TabControl)
.Style = 0
.BackColor = RGB(236, 236, 236)
.BackStyle = 1
.UseTheme = False
.BorderStyle = 1
.BorderColor = RGB(0, 0, 0)
I've written a short public function to control the formatting of a tab control, so that I may have a consistent look for tab controls across forms.
Public Function FormatTabControl(frmActiveForm As Form, ctlTabControl As TabControl)
frmActiveForm.ctlTabControl.Style = 0
frmActiveForm.ctlTabControl.BackColor = RGB(236, 236, 236)
frmActiveForm.ctlTabControl.BackStyle = 1
frmActiveForm.ctlTabControl.UseTheme = False
frmActiveForm.ctlTabControl.BorderStyle = 1
frmActiveForm.ctlTabControl.BorderColor = RGB(0, 0, 0)
When calling the function on form open I get a 2465 error
Replacing ctlTabControl with the name of the control it works. But I want the name of the Tab Control in a variable so I can reuse the code for any Tab Controls I want to affect.
What is the correct way of referring to the Tab Control?
Posted by: "Graham Mandeno" <firstname.lastname@example.org>
|Reply via web post||•||Reply to sender||•||Reply to group||•||Start a New Topic||•||Messages in this topic (4)|