Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object
Message
 
To
12/05/2004 23:04:25
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Re: Object
Miscellaneous
Thread ID:
00902939
Message ID:
00903700
Views:
16
Hi Alvison:
Thanks for getting back to me. I was able to solve this by creating a control array. I than attached the scrollbar to the controal array.
Here is my code.


Private Sub PopulateCntrls()
Dim x As Integer
Dim iTab As Integer
Dim iCount As Integer
Dim sCtlType As String
Dim sCaption As String
Dim sValue As String

bLoading = True
iOldControls = Controls.Count

nObjCount = 1
sFrame = "Frame" & CStr(1)
Controls.Add "VB.Frame", sFrame, Me
'Position the frame and set its properties.
With Controls(sFrame)
.Top = 3960
.Left = 240
.Height = 1815
.Width = 5200
.BorderStyle = 0
.Visible = True
.ZOrder (0)
End With
' Maintain a collection of scrollbar values colScroll.Add 0, sFrame
' Add 3 new controls to the frame.
'
iCount = 1
For x = 0 To 2

Select Case x
Case 0
sCtlType = "Combobox"
Case 1 To 2
sCtlType = "Textbox"
End Select

Select Case sCtlType
'Textbox
Case "Textbox"
Call addObject("Textbox", iCount, x)
'Combo box
Case "Combobox"
Call addObject("Combobox", iCount, x)
End Select
iCount = iCount + 1
Next
Controls(sFrame).Tag = x * 400
bLoading = False
End Sub


Public Sub addObject(cType As String, nPtr As Integer, nTop As Integer)
Dim sValue As String, x%
sValue = ""

Select Case cType
Case "Combobox"

'Combobox
Call Controls.Add("VB.ComboBox", "Combo" & CStr(nPtr), Controls(sFrame))
Load Combo0(nPtr)
Set Combo0(nPtr).Container = Controls(sFrame)
sValue = ""
With Combo0(nPtr)
.Visible = True
.Width = 1580
.Top = 300 + (nTop * 400)
.Tag = .Top
.Left = 370
.Text = sValue
.AddItem "TheScarms Visual Basic Code Library"
.AddItem "www.TheScarms.com"
.AddItem "Visual Basic Source Code"
.AddItem "Win32 API Examples"
.AddItem "Windows/Registry Tips"
End With
Controls.Remove "Combo" & CStr(nPtr)
'Populate the comboboxes on the first tab
Combo0(nPtr).ListIndex = 0
nObjCount = nObjCount + 1

Case "Textbox"
'Textbox
Call Controls.Add("VB.TextBox", "Text" & CStr(nPtr), Controls(sFrame))
Load Text0(nPtr)
Set Text0(nPtr).Container = Controls(sFrame)
With Text0(nPtr)
.Visible = True
.Width = 1580
.Top = Combo0(nObjCount - 1).Top
If nTop = 1 Then
.Left = 2000
Else
.Left = 3600
End If
.Tag = .Top
.Height = 315
.Text = sValue
End With
Controls.Remove "Text" & CStr(nPtr)
End Select
Call pUpdateScrollBar("Frame1")
End Sub

Alvison,how can I tell what is the last item added to the control arry? I need to get the individual values stored in the text box and combo box.

Please help!!
Thanks
MA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform