Resize Form and Detect Size In TextBox
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
2 posts
Page 1 of 1
Got two textbox's one represents the form's width, and the another height.
When the form loads it displays the size of the form's width, and height in each textbox.
When you resize the form it'll automatically update the text in the texbox's and tell you what the form's current size is.
How can I do this?
EDIT:
I figured it out, here's the code for those that want to do the same.
When the form loads it displays the size of the form's width, and height in each textbox.
When you resize the form it'll automatically update the text in the texbox's and tell you what the form's current size is.
How can I do this?
EDIT:
I figured it out, here's the code for those that want to do the same.
Code: Select all
Private sizew As Integer
Private sizey As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = Me.Size.Width()
TextBox2.Text = Me.Size.Height()
End Sub
Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
TextBox1.Text = Me.Size.Width()
TextBox2.Text = Me.Size.Height()
sizew = TextBox1.Text
sizey = TextBox2.Text
Me.Size = New System.Drawing.Size(sizew, sizey)
End Sub
Last edited by mikethedj4 on Fri Jul 20, 2012 7:48 pm, edited 1 time in total.
i think you must use
not sure not using vb
just a guess.
Code: Select all
to resize:
me.top = textbox1.text
me.left = textbox2.text
Code: Select all
or Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
me.top = textbox1.text
me.left = textbox2.text
End Sub
Code: Select all
or
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)
'do something
End Sub
Code: Select all
just looking at my old project from home money manager maybe this helps.Private Sub FORMLogDetails_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
me.top = textbox1.text
me.left = textbox2.text
End Sub
not sure not using vb
just a guess.
visit us on:
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023