473,796 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB2005: Can a usercontrol 'trigger' your main form ?

Hi,

I have a solution containing two projects
- main project with main form containing a statusstrip
- second project containing a usercontrol.

I have added the usercontrol to my main form, all works perfect...

Can my usercontrol 'fire an event' which allows it to change the value(s) on
the main form's statusstrip ?

--
Filip
http://www.ww2airborne.net/
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
[It's nice to be important, but it's more important to be nice!]
----------------------------------------------------------------
Oct 25 '07 #1
13 2423
" Screaming Eagles 101" <se*********@on line.pleasewrot e in
news:47******** *************** @news.scarlet.n l:
>
Can my usercontrol 'fire an event' which allows it to change the
value(s) on the main form's statusstrip ?
Yup. Provided your main form hooks into the event.
Oct 25 '07 #2
"Spam Catcher" <sp**********@r ogers.comschree f in bericht
news:Xn******** *************** ***********@127 .0.0.1...
>" Screaming Eagles 101" <se*********@on line.pleasewrot e in
news:47******** *************** @news.scarlet.n l:
>>
Can my usercontrol 'fire an event' which allows it to change the
value(s) on the main form's statusstrip ?

Yup. Provided your main form hooks into the event.
Thanks, that's promessing,
unfortunately I'm not smart enough to find out how, the reason for my
question here...
Does one have the knowledge how to perform this ?
--
Filip
http://www.ww2airborne.net/
Official Site of the 101st Airborne - 463rd PFA
skype: airborne463pfa-fiwi
[It's nice to be important, but it's more important to be nice!]
----------------------------------------------------------------
Oct 25 '07 #3
" Screaming Eagles 101" <se*********@on line.pleaseschr ieb
"Spam Catcher" <sp**********@r ogers.comschree f in bericht
news:Xn******** *************** ***********@127 .0.0.1...
" Screaming Eagles 101" <se*********@on line.pleasewrot e in
news:47******** *************** @news.scarlet.n l:
>
Can my usercontrol 'fire an event' which allows it to change the
value(s) on the main form's statusstrip ?
Yup. Provided your main form hooks into the event.

Thanks, that's promessing,
unfortunately I'm not smart enough to find out how, the reason for
my question here...
Does one have the knowledge how to perform this ?

http://msdn2.microsoft.com/en-us/lib...w2(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...7y(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...az(VS.71).aspx
Armin
Oct 25 '07 #4
"Armin Zingler" <az*******@free net.deschreef in bericht
news:OP******** *****@TK2MSFTNG P05.phx.gbl...
>" Screaming Eagles 101" <se*********@on line.pleaseschr ieb
>"Spam Catcher" <sp**********@r ogers.comschree f in bericht
news:Xn******* *************** ************@12 7.0.0.1...
" Screaming Eagles 101" <se*********@on line.pleasewrot e in
news:47******** *************** @news.scarlet.n l:
Can my usercontrol 'fire an event' which allows it to change the
value(s) on the main form's statusstrip ?

Yup. Provided your main form hooks into the event.

Thanks, that's promessing,
unfortunatel y I'm not smart enough to find out how, the reason for
my question here...
Does one have the knowledge how to perform this ?


http://msdn2.microsoft.com/en-us/lib...w2(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...7y(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...az(VS.71).aspx
Armin
Thanks, digging around in the code I was able to make the examples
work, etc.. but only if I stay in the usercontrol project completely,
or if I stay in the main form project completely.
I don't get it how I can raise an event in my usercontrol project
and pick it up in my main form project to change the text of the statustrip.

Solution myVB2005Solutio n
+ Project Main
--- frmMain <= change the te text on the statusstrip (or textbox,
whatever), contains an instance of myUserControl
--- frmSplash
--- some modules...
+ Project Mycontrols
--- myUserControl =send a 'trigger' to frmMain to change the text
property of a certain control


Oct 25 '07 #5
" Screaming Eagles 101" <se*********@on line.pleaseschr ieb
"Armin Zingler" <az*******@free net.deschreef in bericht
news:OP******** *****@TK2MSFTNG P05.phx.gbl...
" Screaming Eagles 101" <se*********@on line.pleaseschr ieb
"Spam Catcher" <sp**********@r ogers.comschree f in bericht
news:Xn******** *************** ***********@127 .0.0.1...
" Screaming Eagles 101" <se*********@on line.pleasewrot e in
news:47******** *************** @news.scarlet.n l:

>
Can my usercontrol 'fire an event' which allows it to change
the value(s) on the main form's statusstrip ?

Yup. Provided your main form hooks into the event.
>
Thanks, that's promessing,
unfortunately I'm not smart enough to find out how, the reason
for my question here...
Does one have the knowledge how to perform this ?

http://msdn2.microsoft.com/en-us/lib...w2(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...7y(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...az(VS.71).aspx
Armin

Thanks, digging around in the code I was able to make the examples
work, etc.. but only if I stay in the usercontrol project
completely, or if I stay in the main form project completely.
I don't get it how I can raise an event in my usercontrol project
and pick it up in my main form project to change the text of the
statustrip.

Solution myVB2005Solutio n
+ Project Main
--- frmMain <= change the te text on the statusstrip (or
textbox, whatever), contains an instance of myUserControl
--- frmSplash
--- some modules...
+ Project Mycontrols
--- myUserControl =send a 'trigger' to frmMain to change the
text property of a certain control
You added "Public event xy" to the Usercontrol?
You added "Raiseevent xy" to the Usercontrol?
In the "Main" project, in the code editor for frmMain, you can not select
the event in the top-right combo after selecting the Usercontrol in the
top-left combo?
Armin

Oct 25 '07 #6
" Screaming Eagles 101" <se*********@on line.pleaseschr eef in bericht
news:47******** *************** @news.scarlet.n l...
"Armin Zingler" <az*******@free net.deschreef in bericht
news:OP******** *****@TK2MSFTNG P05.phx.gbl...
>>" Screaming Eagles 101" <se*********@on line.pleaseschr ieb
>>"Spam Catcher" <sp**********@r ogers.comschree f in bericht
news:Xn****** *************** *************@1 27.0.0.1...
" Screaming Eagles 101" <se*********@on line.pleasewrot e in
news:47******* *************** *@news.scarlet. nl:
Can my usercontrol 'fire an event' which allows it to change the
value(s) on the main form's statusstrip ?

Yup. Provided your main form hooks into the event.

Thanks, that's promessing,
unfortunate ly I'm not smart enough to find out how, the reason for
my question here...
Does one have the knowledge how to perform this ?


http://msdn2.microsoft.com/en-us/lib...w2(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...7y(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...az(VS.71).aspx
Armin

Thanks, digging around in the code I was able to make the examples
work, etc.. but only if I stay in the usercontrol project completely,
or if I stay in the main form project completely.
I don't get it how I can raise an event in my usercontrol project
and pick it up in my main form project to change the text of the
statustrip.

Solution myVB2005Solutio n
+ Project Main
--- frmMain <= change the te text on the statusstrip (or textbox,
whatever), contains an instance of myUserControl
--- frmSplash
--- some modules...
+ Project Mycontrols
--- myUserControl =send a 'trigger' to frmMain to change the text
property of a certain control
OK I got it working, thanks for your help. I found what I need.... :-)

* ON THE USER CONTROL:
Public Event myEvent(ByVal s As String)

Private Sub btnReportPrint_ Click(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnReportPrint. Click
RaiseEvent myEvent("Fire!" )
End Sub

* ON FRMMAIN

Public Sub FireEvent(ByVal s As String) Handles InfoControl1.my Event
Me.Text = s & ": okay, I am on frmMain !!!!!"
End Sub


Oct 25 '07 #7
Screaming Eagles,

You can even get it direct by casting it to the parentform of the
usercontrol.

Cor

Oct 26 '07 #8
"Cor Ligthert[MVP]" <no************ @planet.nlschri eb
Screaming Eagles,

You can even get it direct by casting it to the parentform of the
usercontrol.
The question was how to raise and catch an event. In addition, casting to
the parent form type doesn't make the UserControl reusable.
Armin

Oct 26 '07 #9
The question was how to raise and catch an event. In addition, casting to
the parent form type doesn't make the UserControl reusable.
Strange I read something else, even in the subject.

Something wrong with my newsreader?

Cor

Oct 27 '07 #10

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

Similar topics

2
8314
by: Jaikumar | last post by:
Hi, 1) I have created one windows application, In the main form ( form1) i have added one usercontrol (usercontrol1), In that user control i am drawing one image. 2) In the UserControl1 i am showing one transparent form (form3) when ever user preseed left mouse button. 3) The form3 has one transparent user control (usercontrol2) that paints circles. That measn the circles will show on top the usercontrol1 image. 4) The form3 border style...
4
6681
by: Rob Koch | last post by:
What's the best way to refresh a usercontrol using a parameter? My usercontrol is just a DataList that retrieves data from SQL in association with a public propterty. I click on a LinkButton in my main page (ASPX), but it still refreshes the entire page... I only want the UserControl to blink and come back with new data. What's the direction I should be looking at? Even if I do it via JavaScript, how would I refresh the UserControl...
2
1251
by: Lau Lei Cheong | last post by:
Hello, I'm writing a usercontrol that contains a property named "disabled". It is set to false by default but there is also another button in the usercontrol that'll set it to true. On the main form a number of them are displayed. During the On_Load event, 1) It'll check to see if the usercontrol is disabled. If true, the row containing the usercontrol is hidden.
21
1903
by: Simon Verona | last post by:
Hope somebody can help! I want to automatically be able to add code to the initialize routine on a Windows form when I add a custom control that I've written to a form. Specifically, I'm trying to data bind to a normal class. So I've extended the standard text box to include a field for object name and property name. I want to be able to add a line such as : controlname.DataBindings.Add("Text", objectName, "myPropertyName") I've...
41
4331
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based on some initialization information obtained elsewhere. Basically, I'm going to create my own dynamic toolbar where the toolbarbuttons can change. I'm not using the VB toolbar because of limitations in changing things like backcolor (I can't get...
2
8935
by: Rene Sørensen | last post by:
In VS 2005 I'm trying to create a usercontrol, but I have some problems with it right now I can't figure out how to fix. The size of my usercontrol is "Size 574; 619" I have anchored all controls added to the form, so I can resize it up and down, and not left and rigth. My usercontrol is a usercontrol project. In my main program I just drag and drop the control from the Toolbox, her the problems starts, the size of all subcontrols changes...
10
2429
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from the codebehind of the UserControl? For instance, suppose that the UserControl is dropped inside one...
7
4982
by: Edwin Martinez | last post by:
Hello I have a parent form but I want to create 4 forms that will be shown in a area inside the parent form when I click to buttons. +----------------------------+ | Parent Form | | | | -------------------- | | | subform | | | | | | | | | |
0
1101
by: luckilian | last post by:
Hi everyone, i need some help with a tabbed interface. I have this scenario: 1 Main Form 1 UserControl 1 Form when main form is loaded the Usercontrol load .. In the _load handler i want to open then Form in separate thread
0
9680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9052
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7547
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.