Re: user control width property

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"MP" <Nomospam@xxxxxxxxxx> wrote in message
news:432ae8d5$0$4864$8b463f8a@xxxxxxxxxxxxxxxxxxxxxx
>
> ok, tried UserControl.Width and as I mentioned in my last post now the
> control doesn't show up in browser.
> And i was incorrect in thinking it would have a .Visible property...so now
> I'm stuck
> Guess I'll just have to set the width at design time and get on with life.
> :-)
>
> ps, The Me issue seemed strange to me, I figured it was like when
> designing
> a form, Me is a reference to the form itself
> I'm (naively) thinking of a user control as a "special" kind of a
> form(container), and as such assumed Me would be the control itself.
> I even more naively thought if I were in a routine like Sub
> TxtBox1_Click()... that Me.Text would be another way of saying
> TxtBox1.Text....obviously you can't just indiscriminately toss "ME" around
> like that! - I was thinking of it as an omniscient mutable
> self-discovering
> object reference....way out of line eh?
> :-)
>
>
> Thanks
> Mark

Fire up VB, select ActiveX Control as the project type, drop a command
button on the designer, paste this, run, select 'Start Component' with
UserControl1 in the dropdown and, if running XP/SP2, tell IE to allow
blocked content. What you see should be a command button with a 15 twip
border (created by the usercontrol) in a random color.

'==========
Private Sub UserControl_Resize()
Static bHere As Boolean

If Not bHere Then
bHere = True
Command1.Move 15, 15
UserControl.BackColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
UserControl.Width = Command1.Width + 30
UserControl.Height = Command1.Height + 30
bHere = False
End If

End Sub
'==========

Also... when using Me, as soon as you hit the dot, you'll see all available
choices. That list will consist of any procedures you've declared as Friend
or Public.

Remember..... in 99.9% of all cases, if it doesn't show in intellisense as
you type, it's not available. If it's supposed to show and doesn't, there's
a problem with the code/references/other.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..


.


Quantcast