
vb4: bas modules and form modules
Quote:
> Hi,
> I am new to VB programming. I created an app that has a form, I ended up
> writing new procedures into my form module. Recently I read somewhere
> about placing my code into a standard module (*.bas) instead. Currently,
> to change the text in my textbox I have text1.text = "David". If I move
my
> procedure to a standard module (*.bas) will I have to reference the form
> where control resides (form1.text1.text). In this app I am only using
1
> form anyway.
> I am also doing data entry. I add a textbox and in front of it I added a
> label:
> FIRST NAME: _______________
> My textbox has a border style of 1-fixed single and appearance is 3d. I
> wanted my label to be border style: 0. However, the horizontal alignment
> of the 2 controls is a little off. If I change my label to 1 in the
border
> style it will work. But I would rather not do this. I also have
ms-access
> and I don't have this problem when I add controls on a form.
> Thanks for any info,
> David :)
> chapa at spec dot com
In answer to your first question, when you refer to an object in a form
from a module, even if you only have one form, then you must tell the
module what form the object is in. This is done, as you stated, by the
syntax: frmMain.txtFirstName.text
In answer to the second question, forms in VB, have a grid. When you add
or move an object it automatically 'snaps' to this grid. To sort out your
problem, you will have to turn off this snapping to grid. This is done
by, clicking the menuitem, 'Tools', then 'Options'. Select the tab
'Enviroment' (should already be selected), then untick the checkbox 'Align
Controls to Grid'. This should let you move your objects around without
the limit of the grid.
--
-------------------
Dan Clarke
"Imagination is more important than knowledge."
-- Albert Einstein