Click here to Skip to main content
15,902,907 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionPreviousPage.FindControl with a drop down list Pin
nickrjsmith27-Apr-07 0:18
nickrjsmith27-Apr-07 0:18 
AnswerRe: PreviousPage.FindControl with a drop down list Pin
Arun.Immanuel27-Apr-07 2:11
Arun.Immanuel27-Apr-07 2:11 
GeneralRe: PreviousPage.FindControl with a drop down list Pin
nickrjsmith27-Apr-07 2:12
nickrjsmith27-Apr-07 2:12 
GeneralRe: PreviousPage.FindControl with a drop down list Pin
nickrjsmith27-Apr-07 2:13
nickrjsmith27-Apr-07 2:13 
GeneralRe: PreviousPage.FindControl with a drop down list Pin
Arun.Immanuel27-Apr-07 3:37
Arun.Immanuel27-Apr-07 3:37 
GeneralRe: PreviousPage.FindControl with a drop down list Pin
Arun.Immanuel27-Apr-07 2:52
Arun.Immanuel27-Apr-07 2:52 
Questionthe "top" property of a control returns 0 Pin
shubumpkin26-Apr-07 23:57
shubumpkin26-Apr-07 23:57 
AnswerRe: the "top" property of a control returns 0 Pin
Dave Kreskowiak27-Apr-07 4:14
mveDave Kreskowiak27-Apr-07 4:14 
shubumpkin wrote:
am finding that the top attribute of a control (in this case a tree view control) returns top values relative to its panel.


The Location (Left, Top) is alway s relative to the controls parent container.

To get to the form, you have to follow the Parent property of your control to it's parent contain, and keep following it up until Parent returns nothing. When you find that, your code is looking at the Form. A quick and dirty method to do this would be something like:
Public Shared Function GetTopContainerOfControl(ByRef childControl As Control) As Control
    Dim currentControl As Control = c
    While (currentControl.Parent IsNot Nothing)
        currentControl = currentControl.Parent
    End While
    Return currentControl
End Function

This quick example doesn't have any error handling and CAN go on forever if there is a mistake in the control parent/child chain as an infinite loop will result. Since this doesn't use recursion, there is no danger of overflowing the stack, not matter how many levels deep a control is.


Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


QuestionHow to create DLL with vb.net to run with rundll32.exe Pin
Reuven Elliassi26-Apr-07 22:08
Reuven Elliassi26-Apr-07 22:08 
AnswerRe: How to create DLL with vb.net to run with rundll32.exe Pin
Christian Graus26-Apr-07 23:09
protectorChristian Graus26-Apr-07 23:09 
GeneralRe: How to create DLL with vb.net to run with rundll32.exe Pin
Reuven Elliassi26-Apr-07 23:40
Reuven Elliassi26-Apr-07 23:40 
QuestionZModem Code Pin
tomtom7626-Apr-07 21:46
tomtom7626-Apr-07 21:46 
QuestionDataGrid View Control Doubt Pin
A.Muthunagai26-Apr-07 21:39
A.Muthunagai26-Apr-07 21:39 
QuestionGetting the path of a selected file thats is to be copied Pin
aasim baltee26-Apr-07 20:27
aasim baltee26-Apr-07 20:27 
QuestionProblem while reading from CSV file in VB 6.0 Pin
virendra_00726-Apr-07 19:40
virendra_00726-Apr-07 19:40 
AnswerRe: Problem while reading from CSV file in VB 6.0 Pin
manowj26-Apr-07 21:08
manowj26-Apr-07 21:08 
GeneralRe: Problem while reading from CSV file in VB 6.0 Pin
virendra_00726-Apr-07 22:39
virendra_00726-Apr-07 22:39 
GeneralRe: to Manoj Pin
virendra_00727-Apr-07 1:34
virendra_00727-Apr-07 1:34 
QuestionQuestions on Data Reports [modified] Pin
Kumaran21cen26-Apr-07 18:07
Kumaran21cen26-Apr-07 18:07 
QuestionToo many Filewatches! Pin
rudemusik26-Apr-07 16:58
rudemusik26-Apr-07 16:58 
AnswerRe: Too many Filewatches! Pin
KevinMac26-Apr-07 17:12
KevinMac26-Apr-07 17:12 
GeneralRe: Too many Filewatches! Pin
rudemusik27-Apr-07 1:34
rudemusik27-Apr-07 1:34 
GeneralRe: Too many Filewatches! Pin
KevinMac27-Apr-07 5:21
KevinMac27-Apr-07 5:21 
GeneralRe: Too many Filewatches! Pin
rudemusik27-Apr-07 15:43
rudemusik27-Apr-07 15:43 
QuestionC# convert problem Pin
Xmen Real 26-Apr-07 15:29
professional Xmen Real 26-Apr-07 15:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.