TheSwamp

Code Red => VB(A) => Topic started by: T.Willey on July 18, 2006, 06:27:45 PM

Title: Telling the userform where to start at (lesson 3)
Post by: T.Willey on July 18, 2006, 06:27:45 PM
So now that I have the code written, and it seems to be working, how can I tell the userform to start in a specific place?  Save I have two text boxes (which is what I have now) labeled TextBox1 TextBox2 (how original, I know), how to tell the form, when called, to start in TextBox1?  Once I know this, I will post my finished code for all to admire throw rotten tomatoes at.  :-D

Thanks again.
Title: Re: Telling the userform where to start at (lesson 3)
Post by: MP on July 18, 2006, 06:46:16 PM
Hint: SetFocus Method.
Title: Re: Telling the userform where to start at (lesson 3)
Post by: T.Willey on July 18, 2006, 06:55:31 PM
I was looking, and searching for almost an hour.  I thought there had to be some type of set focus, or start in location, but couldn't find it.  Thanks MP.  Here is my first little hybrid.  It is really simple.  It will show a dialog box with two text boxes.  If you fill them in, it will prompt you to change a text/mtext/attribute object.

Save both to a location in the search path (don't know why I'm typing this part).  After loading the lisp, type "TestVBA" to run it.

Thanks again to Michael, Jeff and Bob (no particular order) for all the help they have provided me, and James for starting me off.
Title: Re: Telling the userform where to start at (lesson 3)
Post by: Jeff_M on July 18, 2006, 08:14:06 PM
Worked for me! Congratulations! Now to get you to step away from the ()'s....
:-D

As if I have completely, too.....  :lmao:
Title: Re: Telling the userform where to start at (lesson 3)
Post by: DaveW on July 18, 2006, 10:25:35 PM
Are you looking for

frmMyform.top = 700
frmMyform.left = 1700

???

I usually run a sub called populate on the load event and add the positioning in the populate sub.
Title: Re: Telling the userform where to start at (lesson 3)
Post by: T.Willey on July 19, 2006, 10:59:01 AM
Are you looking for

frmMyform.top = 700
frmMyform.left = 1700

???

I usually run a sub called populate on the load event and add the positioning in the populate sub.
Not really.  I could of cared less where the form showed up on my screen, which is what I think you are teaching me.  MP told me the way to do what I was trying.
UserForm1.TextBox1.SetFocus
is what I was after, and couldn't find.
Thanks though.  This is a learning process for me.
Title: Re: Telling the userform where to start at (lesson 3)
Post by: T.Willey on July 19, 2006, 11:00:16 AM
Worked for me! Congratulations! Now to get you to step away from the ()'s....
:-D

As if I have completely, too.....  :lmao:
Thanks for testing it Jeff.  I don't know if I will be able to leave lisp, it just feel so natural now. :-D

But only time will tell.....
Title: Re: Telling the userform where to start at (lesson 3)
Post by: hendie on July 19, 2006, 11:46:40 AM
... how can I tell the userform to start in a specific place?  .

You can use the TabOrder to specify the order of the controls. (under the View menu) Just set the TabStop value to False for controls you don't want to be able to jump to
Title: Re: Telling the userform where to start at (lesson 3)
Post by: T.Willey on July 19, 2006, 01:01:47 PM
... how can I tell the userform to start in a specific place?  .

You can use the TabOrder to specify the order of the controls. (under the View menu) Just set the TabStop value to False for controls you don't want to be able to jump to
Thanks for the information.  Added to grey matter.
Title: Re: Telling the userform where to start at (lesson 3)
Post by: MP on July 19, 2006, 02:58:04 PM
... MP told me the way to do what I was trying ...

Quick note Tim -- Might be a good idea before invoking setfocus to ensure an object is visible / enabled lest it chuck a wobbly. Sorry haven't had a chance to review your code (cannae d/l from here / busy).
Title: Re: Telling the userform where to start at (lesson 3)
Post by: T.Willey on July 20, 2006, 11:08:05 AM
... MP told me the way to do what I was trying ...

Quick note Tim -- Might be a good idea before invoking setfocus to ensure an object is visible / enabled lest it chuck a wobbly. Sorry haven't had a chance to review your code (cannae d/l from here / busy).
It's all good Michael.  Thanks for that bit of information.