|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Existential question!When I use: Dim X0 As Integer = ActiveForm.Location.X Dim Y0 As Integer = ActiveForm.Location.Y Dim strTest As String = ActiveForm.Name Dim SIX0 = X0 + 560 Dim SIY0 = Y0 - 30 The strTest variable contains the name of the container form (the MDIParent). However, when I do this: Dim X0 As Integer = Me.Location.X Dim Y0 As Integer = Me.Location.Y Dim strTest As String = Me.Name Dim SIX0 = X0 + 560 Dim SIY0 = Y0 - 30 I get the name of the form within the container (called FormMain). More important the locations seem to be all messed up. When I use Me.Location, the 0,0 point is not the topleft of the form, I have to use the negative value to try to position some test at the top. Any advice? Thanx, I forgot to add, my FormMain (dimmed as frmMain) refuses to fill up the
Container i.e. the MDIParent until I switch to another form and then come back. In the Container form I do have: Private Sub FormContainer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load frmMain.MdiParent = Me frmSliceInfo.MdiParent = Me frmSliceInfo.Dock = DockStyle.Fill frmMain.Dock = DockStyle.Fill frmMain.Show() End Sub and I have also set the Dock property in the properties window of all the forms to "None". Show quoteHide quote "Anil Gupte" <anil-l***@icinema.com> wrote in message news:u0uv0ce%23GHA.4388@TK2MSFTNGP02.phx.gbl... > As in "Who am I?" or better "Who am Me?" > > When I use: > Dim X0 As Integer = ActiveForm.Location.X > > Dim Y0 As Integer = ActiveForm.Location.Y > > Dim strTest As String = ActiveForm.Name > > Dim SIX0 = X0 + 560 > > Dim SIY0 = Y0 - 30 > > The strTest variable contains the name of the container form (the > MDIParent). However, when I do this: > > Dim X0 As Integer = Me.Location.X > > Dim Y0 As Integer = Me.Location.Y > > Dim strTest As String = Me.Name > > Dim SIX0 = X0 + 560 > > Dim SIY0 = Y0 - 30 > > I get the name of the form within the container (called FormMain). More > important the locations seem to be all messed up. When I use Me.Location, > the 0,0 point is not the topleft of the form, I have to use the negative > value to try to position some test at the top. > > Any advice? > > Thanx, > -- > Anil Gupte > www.keeninc.net > www.icinema.com > > Anil,
I was quick starting, if it is a MDI, you can always find the parent in the MDI parent property from a child and the childs in the MDIchildren collection (just looping). http://msdn2.microsoft.com/en-us/library/system.windows.forms.form.mdichildren.aspx Cor Show quoteHide quote "Anil Gupte" <anil-l***@icinema.com> schreef in bericht news:OHFYyke%23GHA.4544@TK2MSFTNGP05.phx.gbl... >I forgot to add, my FormMain (dimmed as frmMain) refuses to fill up the >Container i.e. the MDIParent until I switch to another form and then come >back. In the Container form I do have: > Private Sub FormContainer_Load(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles MyBase.Load > > frmMain.MdiParent = Me > > frmSliceInfo.MdiParent = Me > > frmSliceInfo.Dock = DockStyle.Fill > > frmMain.Dock = DockStyle.Fill > > frmMain.Show() > > End Sub > > and I have also set the Dock property in the properties window of all the > forms to "None". > -- > Anil Gupte > www.keeninc.net > www.icinema.com > > "Anil Gupte" <anil-l***@icinema.com> wrote in message > news:u0uv0ce%23GHA.4388@TK2MSFTNGP02.phx.gbl... >> As in "Who am I?" or better "Who am Me?" >> >> When I use: >> Dim X0 As Integer = ActiveForm.Location.X >> >> Dim Y0 As Integer = ActiveForm.Location.Y >> >> Dim strTest As String = ActiveForm.Name >> >> Dim SIX0 = X0 + 560 >> >> Dim SIY0 = Y0 - 30 >> >> The strTest variable contains the name of the container form (the >> MDIParent). However, when I do this: >> >> Dim X0 As Integer = Me.Location.X >> >> Dim Y0 As Integer = Me.Location.Y >> >> Dim strTest As String = Me.Name >> >> Dim SIX0 = X0 + 560 >> >> Dim SIY0 = Y0 - 30 >> >> I get the name of the form within the container (called FormMain). More >> important the locations seem to be all messed up. When I use >> Me.Location, the 0,0 point is not the topleft of the form, I have to use >> the negative value to try to position some test at the top. >> >> Any advice? >> >> Thanx, >> -- >> Anil Gupte >> www.keeninc.net >> www.icinema.com >> >> > > I am sorry, I did not understand your response. First of all why does it
(fmrMain) not fill up the container form? The other form (frmSliceInfo) does, and all the parameters are the same. Also, why is Me not the same as ActiveForm? Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23Oa8Eue%23GHA.4800@TK2MSFTNGP05.phx.gbl... > Anil, > > I was quick starting, if it is a MDI, you can always find the parent in > the MDI parent property from a child and the childs in the MDIchildren > collection (just looping). > > http://msdn2.microsoft.com/en-us/library/system.windows.forms.form.mdichildren.aspx > > Cor > > "Anil Gupte" <anil-l***@icinema.com> schreef in bericht > news:OHFYyke%23GHA.4544@TK2MSFTNGP05.phx.gbl... >>I forgot to add, my FormMain (dimmed as frmMain) refuses to fill up the >>Container i.e. the MDIParent until I switch to another form and then come >>back. In the Container form I do have: >> Private Sub FormContainer_Load(ByVal sender As System.Object, ByVal e As >> System.EventArgs) Handles MyBase.Load >> >> frmMain.MdiParent = Me >> >> frmSliceInfo.MdiParent = Me >> >> frmSliceInfo.Dock = DockStyle.Fill >> >> frmMain.Dock = DockStyle.Fill >> >> frmMain.Show() >> >> End Sub >> >> and I have also set the Dock property in the properties window of all the >> forms to "None". >> -- >> Anil Gupte >> www.keeninc.net >> www.icinema.com >> >> "Anil Gupte" <anil-l***@icinema.com> wrote in message >> news:u0uv0ce%23GHA.4388@TK2MSFTNGP02.phx.gbl... >>> As in "Who am I?" or better "Who am Me?" >>> >>> When I use: >>> Dim X0 As Integer = ActiveForm.Location.X >>> >>> Dim Y0 As Integer = ActiveForm.Location.Y >>> >>> Dim strTest As String = ActiveForm.Name >>> >>> Dim SIX0 = X0 + 560 >>> >>> Dim SIY0 = Y0 - 30 >>> >>> The strTest variable contains the name of the container form (the >>> MDIParent). However, when I do this: >>> >>> Dim X0 As Integer = Me.Location.X >>> >>> Dim Y0 As Integer = Me.Location.Y >>> >>> Dim strTest As String = Me.Name >>> >>> Dim SIX0 = X0 + 560 >>> >>> Dim SIY0 = Y0 - 30 >>> >>> I get the name of the form within the container (called FormMain). >>> More important the locations seem to be all messed up. When I use >>> Me.Location, the 0,0 point is not the topleft of the form, I have to use >>> the negative value to try to position some test at the top. >>> >>> Any advice? >>> >>> Thanx, >>> -- >>> Anil Gupte >>> www.keeninc.net >>> www.icinema.com >>> >>> >> >> > > Thre is one difference: frmMain is shown during the load event of the
mdiform. Try loading frmMain after the mdi form is fully loaded. Me is the instance you are currently in (if frmMaincode, me means frmmain, in frmSliceInfo code, me means frmSliceInfo). ActiveForm is the activeform of the project. So to see the difference: 'code in frmSliceInfo, which is active frmMain.mySub 'calls a routine in frmMain 'code in frmMain: Public Sub mySub() 'When called from above 'Me is frmMain 'ActiveForm is frmSliceInfo 'When called when frmMain is active 'Me is still frmMain 'ActiveForm is now also frmMain End Sub Anil Gupte wrote: Show quoteHide quote > I am sorry, I did not understand your response. First of all why does it > (fmrMain) not fill up the container form? The other form (frmSliceInfo) > does, and all the parameters are the same. Also, why is Me not the same as > ActiveForm? > How do I load frmMain after the MDI container is loaded? There is no other
event I can call as far as I know. I may have fixed the problem though by adding the line: frmMain.Size = Me.Size to the Private Sub FormContainer_Load event Thanx for the input. Show quoteHide quote "Theo Verweij" <tverw***@xs4all.nl> wrote in message news:ORrI4Cf%23GHA.3456@TK2MSFTNGP02.phx.gbl... > Thre is one difference: frmMain is shown during the load event of the > mdiform. Try loading frmMain after the mdi form is fully loaded. > > Me is the instance you are currently in (if frmMaincode, me means frmmain, > in frmSliceInfo code, me means frmSliceInfo). > ActiveForm is the activeform of the project. > > So to see the difference: > > 'code in frmSliceInfo, which is active > frmMain.mySub 'calls a routine in frmMain > > > 'code in frmMain: > Public Sub mySub() > 'When called from above > 'Me is frmMain > 'ActiveForm is frmSliceInfo > > 'When called when frmMain is active > 'Me is still frmMain > 'ActiveForm is now also frmMain > End Sub > > > Anil Gupte wrote: >> I am sorry, I did not understand your response. First of all why does it >> (fmrMain) not fill up the container form? The other form (frmSliceInfo) >> does, and all the parameters are the same. Also, why is Me not the same >> as ActiveForm? >> Or use frmMain.windowstate = FormWindowState.Maximized instead of the
dock property - It seems this is what you want after all. Anil Gupte wrote: Show quoteHide quote > How do I load frmMain after the MDI container is loaded? There is no other > event I can call as far as I know. I may have fixed the problem though by > adding the line: > frmMain.Size = Me.Size > > to the Private Sub FormContainer_Load event > > Thanx for the input. Anil,
Me is the same as in the C languages "this". It means all the variables (objects values) that are in the object from the class itself. me.textBox1 is the same as textbox1. It is easy however if you don't remember a name to type first me. It is also easy to tell to another object which object is the sender, The problem is that you are not telling what kind of form you are using, it can by instance be a MDI, a showdialog or something used as a usercontrol inside your control container. Cor Show quoteHide quote "Anil Gupte" <anil-l***@icinema.com> schreef in bericht news:u0uv0ce%23GHA.4388@TK2MSFTNGP02.phx.gbl... > As in "Who am I?" or better "Who am Me?" > > When I use: > Dim X0 As Integer = ActiveForm.Location.X > > Dim Y0 As Integer = ActiveForm.Location.Y > > Dim strTest As String = ActiveForm.Name > > Dim SIX0 = X0 + 560 > > Dim SIY0 = Y0 - 30 > > The strTest variable contains the name of the container form (the > MDIParent). However, when I do this: > > Dim X0 As Integer = Me.Location.X > > Dim Y0 As Integer = Me.Location.Y > > Dim strTest As String = Me.Name > > Dim SIX0 = X0 + 560 > > Dim SIY0 = Y0 - 30 > > I get the name of the form within the container (called FormMain). More > important the locations seem to be all messed up. When I use Me.Location, > the 0,0 point is not the topleft of the form, I have to use the negative > value to try to position some test at the top. > > Any advice? > > Thanx, > -- > Anil Gupte > www.keeninc.net > www.icinema.com > >
vb.net; controls
Adding Lines to Access Database Merging two VB.NET projects how to check whether a number is an integer? Detecting textchanged event when user initiates it Exception message How to tell if my app is running on laptop or desktop? Creating a new database with limits using SMO How to Reference a .Net Assembly from within VBA? Communicate with parallel port via web interphace |
|||||||||||||||||||||||