473,395 Members | 1,762 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,395 software developers and data experts.

check if one control top edge is = another controls bottom edge

hi, i want to check each time a control, in this case a picturebox, moves to
see if its top edge is = another controls bottom edge, but the problem is i
dont kno what the second control will be. how can i achieve this? thanks
--
-iwdu15
Nov 21 '05 #1
3 1074
Create a function that checks, i.e.

Function chk_TopBot(pic as control, other as control)
if pic.Top = other.Top + other.Height then return True else return False
End Function

Note that you might want to convert the tops of both controls to screen
coordinates before checking if they don't have the same parent.

--
Dennis in Houston
"iwdu15" wrote:
hi, i want to check each time a control, in this case a picturebox, moves to
see if its top edge is = another controls bottom edge, but the problem is i
dont kno what the second control will be. how can i achieve this? thanks
--
-iwdu15

Nov 21 '05 #2
sorry if i didnt state my question clear enough...i dont kno exactly what the
other contorl will be, so i didnt kno if there was something that was like
"if control hits another control" or soemthing like that...like im moving a
picturebox according to a user and i wont kno if somehting will be above it
or not, so if there is, then i want it to stop when it hits the bottom, but i
dont kno exactly what the control will be
Nov 21 '05 #3
You can look at each control in your form for the control position.
Unfortunately, you do need to know what type of controls are on the
form so that you can access their properties. You can chaeck the
properties for top and height to find the bottom on a control.

This is untested, but the code should be something similar.

Dim Ctrl As Object
For Each Ctrl In Me.Controls
If Ctrl.GetType Is GetType(TextBox) Then
If CType(Ctrl, TextBox).Top + CType(Ctrl,TextBox).Height = somevalue
Then
CType(Ctrl, TextBox).Focus()
DoSomething
Exit For
End If
End If
If Ctrl.GetType Is GetType(Button) Then
If CType(Ctrl, Button).Top + CType(Ctrl,Button).Height = somevalue
Then
CType(Ctrl, Button).Focus()
DoSomething
Exit For
End If
End If
Next

Nov 21 '05 #4

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

Similar topics

5
by: fgh | last post by:
Hello, two questions please: 1) In a treeview, I want to display folders like it is done in Windows Explorer. Do I have to do this manually or can I set something up in VS.NET 2003? 2) Most...
1
by: Mark Oliver | last post by:
Hi, How do I install an instance of a Provider Control in a way that the IDE will understand - so that the extended properties the Provider Control adds are show in the IDE property grid? In...
6
by: William Sullivan | last post by:
I want to fill a cell in a table with a control. Lets say the control is a listbox--something that you'd think would easily fill a cell, which would be a good thing. So I create the table and...
4
by: gsb58 | last post by:
Hi! On a form I have a calendar. The form is rezised to 1024x768 (Don't worry - this is a training case) when loaded. Now I want to center the calendar on the form so that its edges are...
11
by: herman404 | last post by:
Hi everyone, I have a DataGrid that displays data on a dialog application. When the dialog is resized, the datagrid keeps the same shape, We would need the datagrid to keep a relative shape...
2
by: tshad | last post by:
User VS 2003, I would like to use User Controls to control the page look with 3 User Controls (...PageTop.ascx, ...NavigateTop.ascx and PageBottom.ascx). I would put the Content User control...
10
by: Miro | last post by:
I wanted certain text boxes ( only certain ones ) to always be Trim'd so that spaces are not in the begining, nor the end of the text entered. I created my own "Handle ?" - i hope thats the...
8
by: Rob | last post by:
Is it possible for a control to raise an event to remove itself ? Specifically... I have a FlowLayoutPanel that contains several instances of the same user control. Within each "user"...
3
by: =?Utf-8?B?Qw==?= | last post by:
Hi, I have a user control which I use on all my pages. The control is situated on the top of my page (sits on my master page). For some long pages the user has to scroll back up to the top of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.