vb 6.0 passing arguments
From: Tone Southerland (tone.333_at_comcast.net)
Date: 10/31/03
- Next message: KRIS: "Re: Projects"
- Previous message: Bill: "Re: SIMPLE algorithm that took me by surprise."
- Next in thread: Programmer Dude: "Re: vb 6.0 passing arguments"
- Reply: Programmer Dude: "Re: vb 6.0 passing arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Oct 2003 06:41:41 -0800
Hi everyone,
I need help passing arguments in VB 6.0. I have set up a program to
dynamically create buttons and also access an EXE path from a database
to run a program. My problem lies in passing a string (xxx) variable
instead of an integer or literal string. I am trying to pass the var
xxx simply as a test, so if that works then I can pull actual path
from DB and put it into another variable. I get the error 'Object
variable or with block variable not set.' The error comes from where
I try to put the string into the array(or collection I forget which
one). I don't understand why it will take a literal string but not
string variable. A snippet of my code is below. Thanx for anyone
who can help!
Tone
Private Sub Form_Load()
lblTitle.Width = 8750
LoadControl Me, "VB.PictureBox", "picObj", "", Me.Height - 400,
Me.Width - 400, 450, 0
Dim z As Integer
Dim xxx As String
xxx = "123"
For z = 0 To 3
intTop = intTop + 360
LoadControl Me, "VB.CommandButton", xxx, "Command" & z, 315,
2000, intTop, intLeft
Next z
End Sub
Sub LoadControl(frm As Form, strControlType As String, strControlName
As String, strPathName As String, intHeight As Integer, intWidth As
Integer, intTop As Integer, intLeft As Integer)
On Error Resume Next
Dim newBtn As Control
Set newBtn = frm.Controls.Add(strControlType, strControlName)
' Set lblTitle.Container = newBtn
With newBtn
.Height = intHeight
.Width = intWidth
.Top = intTop
.Left = intLeft
.Visible = True
End With
ReDim Preserve clsBtn(UBound(clsBtn) + 1)
If Err Then ReDim Preserve clsBtn(0): Err.Clear
Set clsBtn(UBound(clsBtn)) = New clsControl
clsBtn(UBound(clsBtn)).Index = UBound(clsBtn)
If (TypeOf newBtn Is CommandButton) Then
newBtn.Caption = strControlName
Set newBtn.Container = frm.Controls("picObj")
Set clsBtn(UBound(clsBtn)).btn = newBtn
End If
If Err Then
MsgBox Err.Number & ": " & Err.Description, vbExclamation
Err.Clear
End
End If
End Sub
- Next message: KRIS: "Re: Projects"
- Previous message: Bill: "Re: SIMPLE algorithm that took me by surprise."
- Next in thread: Programmer Dude: "Re: vb 6.0 passing arguments"
- Reply: Programmer Dude: "Re: vb 6.0 passing arguments"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]