apoorvamehta
asked on
Creating VB objects programmatically
hi,
i am trying to create a program that opens a text file and designs a form according to this text file.
the problem i am having is that i cant create a vb object (checkbox, textbox etc) programmatically..
I have tryed the following:
Dim asdf As TextBox
with asdf.
.alignment = "XXX"
' and so on
end with
but that doesnt work.. i am not quite sure how to do this..
Any help will be appreciated
Thanks
i am trying to create a program that opens a text file and designs a form according to this text file.
the problem i am having is that i cant create a vb object (checkbox, textbox etc) programmatically..
I have tryed the following:
Dim asdf As TextBox
with asdf.
.alignment = "XXX"
' and so on
end with
but that doesnt work.. i am not quite sure how to do this..
Any help will be appreciated
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i meant.. i get the checkbox on the right of the text unlike the normal checkbox
ASKER
i am sorry.. really stupid question..
(the alignment should be 1..)
thanks again
have a good day
Apoorva
(the alignment should be 1..)
thanks again
have a good day
Apoorva
>>when i make a check box.. i get the chekbox on the left of the text..
That's what a typical checkbox is it. If you want to make the text appears to the left of checkbox, you can:
1. empty the Caption property of that checkbox
2. and then add a label on the left of that checkbox, and type the text whatever you wanted.
Anyway, thks for the pts, and glad could make help here 8-) cheers
That's what a typical checkbox is it. If you want to make the text appears to the left of checkbox, you can:
1. empty the Caption property of that checkbox
2. and then add a label on the left of that checkbox, and type the text whatever you wanted.
Anyway, thks for the pts, and glad could make help here 8-) cheers
It's ok, apoorvamehta. 8-) Have a nice day too.
Damn.. my mistake... if you want to have a checkbox with text align on left, you can try like:
Dim WithEvents asdf As CheckBox
Private Sub Form_Load()
Set asdf = Me.Controls.Add("VB.CheckB ox", "text2")
With asdf
.Alignment = 1
.Visible = True
.Left = 0
.Top = 20
.Caption = "hello world"
End With
MsgBox asdf.Name
End Sub
Private Sub asdf_Click()
MsgBox "you click me!"
End Sub
Sorry if i misunderstand your above question ;-)
Dim WithEvents asdf As CheckBox
Private Sub Form_Load()
Set asdf = Me.Controls.Add("VB.CheckB
With asdf
.Alignment = 1
.Visible = True
.Left = 0
.Top = 20
.Caption = "hello world"
End With
MsgBox asdf.Name
End Sub
Private Sub asdf_Click()
MsgBox "you click me!"
End Sub
Sorry if i misunderstand your above question ;-)
ASKER
did u know why the text is on the right sided of the textbox..
when i make a check box.. i get the chekbox on the left of the text..