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

Passing Form as Control !!

Hello
I would like to pass a Form as a control to a method that take a Control
as Parameter ...., is this possible, how it could be

thanks and best regards
Waleed Seada
Nov 17 '05 #1
7 1325
public void SomeMethod(Form myForm)
{
}
Is this what you want?

"Waleed Seada" <ds**********@hotmail.com> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl...
Hello
I would like to pass a Form as a control to a method that take a
Control
as Parameter ...., is this possible, how it could be

thanks and best regards
Waleed Seada

Nov 17 '05 #2
It would just work. A WindowsForms Form would be implicity cast to a
Control.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton

"Waleed Seada" <ds**********@hotmail.com> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl...
Hello
I would like to pass a Form as a control to a method that take a Control as Parameter ...., is this possible, how it could be

thanks and best regards
Waleed Seada

Nov 17 '05 #3
Waleed Seada wrote:
I would like to pass a Form as a control to a method that take a Control
as Parameter ...., is this possible, how it could be


Not sure what the question is - have you tried it? Of course it should be
possible because the Form derives from Control. The problem might be what
the method in question actually does with the Form, possibly it doesn't
expect to get one passed in - but then it should throw an exception if it
was properly written.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Nov 17 '05 #4
HI all
Sorry for the unclear question !!
What I wanted to do is simply, I declare a method that takes Argument of
Control type like : InspectObject(Control C)
My question is, should this works if I call that method like this
InspectObject(this), where this is the current Form ??

Thanks and best regards
Waleed Seada

"Waleed Seada" <ds**********@hotmail.com> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl...
Hello
I would like to pass a Form as a control to a method that take a Control as Parameter ...., is this possible, how it could be

thanks and best regards
Waleed Seada

Nov 17 '05 #5
"Waleed Seada" <ds**********@hotmail.com> wrote:
InspectObject(Control C)
My question is, should this works if I call that method
like this InspectObject(this), where this is the current
Form ??


Yes. Form inherits from Control, so all Forms are Controls.

P.
Nov 17 '05 #6
Yes Waleed, it would work. A Form *IS* a Control.

Sounds like you could do with reading a tutorial/book on Object Oriented
Programming.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton

"Waleed Seada" <ds**********@hotmail.com> wrote in message
news:uC**************@TK2MSFTNGP12.phx.gbl...
HI all
Sorry for the unclear question !!
What I wanted to do is simply, I declare a method that takes Argument of Control type like : InspectObject(Control C)
My question is, should this works if I call that method like this
InspectObject(this), where this is the current Form ??

Thanks and best regards
Waleed Seada

"Waleed Seada" <ds**********@hotmail.com> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl...
Hello
I would like to pass a Form as a control to a method that take a

Control
as Parameter ...., is this possible, how it could be

thanks and best regards
Waleed Seada


Nov 17 '05 #7
Thanks, I try it and it works, I know it should but there was another error
making me conflict
Thanks Guys

Waleed Seada

"Paul E Collins" <fi******************@CL4.org> wrote in message
news:dg**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
"Waleed Seada" <ds**********@hotmail.com> wrote:
InspectObject(Control C)
My question is, should this works if I call that method
like this InspectObject(this), where this is the current
Form ??


Yes. Form inherits from Control, so all Forms are Controls.

P.

Nov 17 '05 #8

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

Similar topics

1
by: sofakingfree | last post by:
I keep getting an invalid property assignment error when tring to reference a subform. All I am trying to do is substitute this: Forms!!.SetFocus for this: FormAndSubForm.SetFocus
2
by: Curtis Justus | last post by:
Hi, I currently have a control that is on a form and I want to pass that exact instance of the control to another form (a child form that appears on a button click). The control has state,...
10
by: Mark Denardo | last post by:
Hi, I have multi-threaded application that requires one particular thread (Non-Form based) to receive data from other threads. I know how to pass control to Form Threads, but I believe there's no...
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
2
by: dixiecanterbury | last post by:
I have a tree view on a form and I need to pass that treeview to another form keeping the state of the treeview (expanded nodes, etc). After the treeview has been manipulated (added nodes,...
3
by: MikeY | last post by:
Hi everyone, I'm having problems, or should I say still having problems with trying to pass data from my custom buttons in my custom controls to my main form listview box. Still scratching my...
2
by: dath | last post by:
Hi, Searched the forum and found a lot on passing form input to aquery but not the other way around. Here is the situation: I have a timesheet form based on a subform query that asks the...
9
by: Chris | last post by:
Ok, so I have this sub I wrote, and I create a new instance of a UserControl: ctrlAPs tempctrl = new ctrlAPs(); Now, I would like to be able to use this sub I wrote for more than one...
0
by: AAaron123 | last post by:
On a Form I have a RichTextBox. I do the call for EM_SETEVENTMASK with ENM_REQUESTRESIZE The user control's WndProc writes to the consol to keep track of any EN_REQUESTRESIZE messages. As...
4
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.