Try two possibilities:
MessageBox.Show("Form1 size: " & Me.Size.ToString)
-- or --
MessageBox.Show($"Form1 size: {Me.Size}")
To show the width only:
MessageBox.Show($"Form1 width = {Me.Width}.")
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello & Tanks ;
vb.net .vb How to show Form1 Size in msgbox
Error msg: 1>\Form1.vb(35,53): error BC30469: Reference to a non-shared member requires an object reference.
It would be be quite helpful in Form Design .
Below is my code .
Thanks for your Help...
Private Sub Form1_ResizeEnd(ByVal sender As Object, ByVal e As EventArgs)
MessageBox.Show("Form1. Width is Now = ." & Control.Size.Width)
End Sub
Try two possibilities:
MessageBox.Show("Form1 size: " & Me.Size.ToString)
-- or --
MessageBox.Show($"Form1 size: {Me.Size}")
To show the width only:
MessageBox.Show($"Form1 width = {Me.Width}.")
Thanks ;
Turns out neither of those work , so I just tried
MsgBox("Form1 size: " & " Sub Form1_Resize ")
Which also didn't work ,
so I conclude that the Resize event is not firing .
Your thoughts & how to fix ?
Thanks...
Oops here's the code:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs)
' Private Sub Form1_ResizeEnd(ByVal sender As Object, ByVal e As EventArgs)
EachSetLine.Text = EachSetLine.Text & Me.Size.ToString
' MsgBox("Form1 size: " & Me.Size.ToString)
' MessageBox.Show($"Form1 width = {Me.Width}.")
MsgBox("Form1 size: " & " Sub Form1_Resize ")
End Sub
Thanks Daniel ;
Yes that works fine .
Why doesnt this Location work ? :
Private Sub GetElementsByTagName_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebBrowser1.ScriptErrorsSuppressed = True
Me.Size = New System.Drawing.Size(1000, 650)
Me.MinimumSize = New Size(1000, 650)
' GetElementsByTagName.Location = New Point(40, 20);
' Me.StartPosition = FormStartPosition.CenterScreen
' GetElementsByTagName.Left = 40;
' GetElementsByTagName.Top = 20;
WebBrowser1.Navigate("http://vmars.us/SafeBrowser/SafeBrowserHome.html")
End Sub
Thanks
Thanks ;
This confused me for hours :
Me.Size = New System.Drawing.Size(1000, 650)
Turns out I didnt really need it .
But I did really need this ;
Me.StartPosition = FormStartPosition.CenterScreen
Before I could get this to work :
Me.Left = 40
Me.Top = 20
Private Sub GetElementsByTagName_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebBrowser1.ScriptErrorsSuppressed = True
WebBrowser1.IsWebBrowserContextMenuEnabled = False
Me.MinimumSize = New Size(1000, 650)
Me.StartPosition = FormStartPosition.CenterScreen
Me.Left = 40
Me.Top = 20
WebBrowser1.Navigate("http://vmars.us/SafeBrowser/SafeBrowserHome.html")
End Sub
Thanks