Hi all,
I'm using Visual Basic 2005. I would like to loop through the controls
and wite or get some properties based on the controls.
This is the following piece of code in Visual Basic 6.0
For Each ctl In frm.Controls
sCtlType = TypeName(ctl)
If sCtlType = "Label" Then
ctl.Caption = objLocalizer.Ge tResourceString (CInt(ctl.Tag))
ElseIf sCtlType = "CommandBut ton" Then
nVal = 0
nVal = Val(ctl.Tag)
ElseIf sCtlType = "Menu" Then
ctl.Caption =
objLocalizer.Ge tResourceString (CInt(ctl.Capti on))
ElseIf sCtlType = "TabStrip" Then
For Each obj In ctl.Tabs
obj.Caption =
objLocalizer.Ge tResourceString (CInt(obj.Tag))
obj.ToolTipText =
objLocalizer.Ge tResourceString (CInt(obj.ToolT ipText))
Next
ElseIf sCtlType = "Toolbar" Then
For Each obj In ctl.Buttons
obj.ToolTipText =
objLocalizer.Ge tResourceString (CInt(obj.ToolT ipText))
Next
ElseIf sCtlType = "ListView" Then
For Each obj In ctl.ColumnHeade rs
obj.Text =
objLocalizer.Ge tResourceString (CInt(obj.Tag))
Next
ElseIf sCtlType = "ctList" Then
ctl.HeaderFont = fnt
Count = ctl.ColumnCount
For Index = 1 To Count
ctl.ColumnText( Index) =
objLocalizer.Ge tResourceString (CInt(ctl.Colum nText(Index)))
Debug.Print ctl.ColumnText( Index)
Next Index
ElseIf sCtlType = "SSTab" Then
For Index = 0 To ctl.Tabs
ctl.TabCaption( Index) =
objLocalizer.Ge tResourceString (CInt(ctl.TabCa ption(Index)))
Next Index
ElseIf sCtlType = "ActiveBar" Then
Dim i As Integer
Dim J As Integer
Dim BandCount As Integer
Dim ToolsCount As Integer
BandCount = ctl.Bands.Count
For i = 0 To BandCount
ToolsCount = ctl.Bands(Index ).Tools.Count
For J = 0 To ToolsCount
nVal = 0
nVal = Val(ctl.Bands(i ).Tools(J).Tag)
If nVal > 0 Then
ctl.Bands(i).To ols(J).Caption =
objLocalizer.Ge tResourceString (nVal)
End If
nVal = 0
nVal = Val(ctl.Bands(i ).Tools(J).Tool TipText)
If nVal > 0 Then
ctl.Bands(i).To ols(J).ToolTipT ext =
objLocalizer.Ge tResourceString (nVal)
End If
Next J
Next i
Else
nVal = 0
nVal = Val(ctl.Tag)
If nVal > 0 Then ctl.Caption =
objLocalizer.Ge tResourceString (nVal)
nVal = 0
nVal = Val(ctl.ToolTip Text)
If nVal > 0 Then ctl.ToolTipText =
objLocalizer.Ge tResourceString (nVal)
End If
Next
When the same code is to be converted to Visual Basic 2005, i would
like to know how to access
1. ctl.HeaderFont in case of "ctList"
2. ctl.ColumnCount in case of "ctList"
3. ctl.ColumnText( Index) in case of "ctList"
4. ctl.Tabs in case of ctl is a SSTab
5. ctl.TabCaption( Index) in case of a Tab in SSTab
Any Help in this regard would be appreciated
Thanks in advance,
Sugan