473,320 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Need resize events, not minimise/restore?

Hello
I have a listbox in my form, which I want to clear if the form's
hieght changes. I am having difficulty with that, as it seems
when the form is minimised the height changes, this is not
what I need, I need only changes to non minimised sizes, i.e.
when the user uses the mouse to increase the size?
Sep 20 '08 #1
2 1198
null wrote:
Hello
I have a listbox in my form, which I want to clear if the form's
hieght changes. I am having difficulty with that, as it seems
when the form is minimised the height changes, this is not
what I need, I need only changes to non minimised sizes, i.e.
when the user uses the mouse to increase the size?

Check WindowState:

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
'
If Not Me.WindowState = FormWindowState.Minimized Then
ListBox1.Items.Clear()
End If

End Sub

However, with the code above ListBox gets cleared when the minimized form is restored. If you
do not want to clear ListBox when the form is restored:

Private g_IsRestoreNextResizeEvent As Boolean

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
'
If Me.WindowState = FormWindowState.Minimized Then
g_IsRestoreNextResizeEvent = True
ElseIf g_IsRestoreNextResizeEvent Then
g_IsRestoreNextResizeEvent = False
Else
ListBox1.Items.Clear()
End If

End Sub

Hope this helps.

--

Teme64 @ http://windevblog.blogspot.com
Sep 20 '08 #2
perfectly, yes!!
Sep 20 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Serge Shimanovsky | last post by:
Hi, I have a situation where I need to clear the event sinks from an event. But let's say I don't know which methods (by name, I mean) signed up for that event. I do have a control with...
3
by: web1110 | last post by:
When a resize event occurs, how do I determine if the resize is due to a User resize Minimize Maximize Restore Thanx, Bill
4
by: Rob Richardson | last post by:
Greetings! I have a form with a listview, a menu, and a few text boxes, labels and command buttons. I want to resize the listview when the form is resized to that the widths of the spaces...
2
by: alien2_51 | last post by:
I want the grid I'm using in a winform application to resize on the maximize/minimize events and form resize events, whats the best way to do this, a sample would be helpful also..?
5
by: smarty | last post by:
I have an example of code that allows and application to minise to the notification tray but how can I override the minimise and close buttons to ensure they always go back to the notify tray...
11
by: Ajith Menon | last post by:
I have created a windows application in which the form needs to be resized on the MouseMove event. The windows resize function takes a lot of CPU cycles. And as the resize function is called on the...
3
by: monadel | last post by:
Hi guys, How do you resize a form in VB. Basically when user drag the form to minimise or maximise, it will resize all the components inside the form. thanks
0
by: Peter Anthony | last post by:
It seems kind of strange that if a Form is just moved that Resize events fire. This makes it hard to tell the difference betweeen resizing and moving a Form. I can understand why resizing might...
3
by: Justin | last post by:
What is the difference between automatic and DMS Auto-resize tablespace?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.