|
Thanks for the encouragement.
Here's how I solved it, based on your example:
Relavant Main Form Code:
private void btnAddQuery_Click(object sender, EventArgs e)
{
SQLXmlInterface newSxi = new SQLXmlInterface();
newSxi.SaveButtonClicked += new System.EventHandler(SQLXmlInteface_SaveButtonHandler);
sqlInterfaces.Add(newSxi);
tlpQueries.Controls.Clear();
foreach (SQLXmlInterface sxi in sqlInterfaces)
{
sxi.Refresh();
tlpQueries.Controls.Add(sxi);
}
RefreshControls();
}
private void SQLXmlInteface_SaveButtonHandler(object sender, EventArgs e)
{
RefreshControls();
}
Here's the relevant Dynamically Added Child Control Code:
public partial class SQLXmlInterface : UserControl
{
SQLXmlObject sqlObject;
bool saved = false;
bool validated = true;
public event EventHandler SaveButtonClicked;
private void btnSave_Click(object sender, EventArgs e)
{
saved = true;
sqlObject = new SQLXmlObject(txtTitle.Text, txtQuery.Text);
RefreshControls();
if (SaveButtonClicked != null)
SaveButtonClicked(this, EventArgs.Empty);
}
}
Synopsis (please correct if I've got it wrong):
The Main Form "listens" to the child control by the EventHandler assigned to the newSxi.SaveButtonClicked event.
The child object btnSave_Click event triggers (just calls, really) the SaveButtonClicked event.
Since the Main Form has the EventHandler defined for the SaveButtonClicked event, when the SaveButtonClicked event occurs, the EventHandler for the Main Form runs the SQLXmlInteface_SaveButtonHandler method, which was assigned to it in this code from the Main Form:
newSxi.SaveButtonClicked += new System.EventHandler(SQLXmlInteface_SaveButtonHandler);
|
|
|
|
|
A+ my friend! Events are not the easiest thing to wrap your brain around.
BTW, I might add that it's really not proper to include the text "Interface" in an object. (There is an actual .Net object called an interface)
The subject of an interface is entirely for another time but it is a very helpful tool.
I would suggest: "SQLXmlEditor" or "SQLXmlViewer" depending on it's functionality.
The mind is like a parachute. It doesn’t work unless it’s open.
|
|
|
|
|
Hi,
Does anyone know of a convenient way to play mp3 files without using windows media player component??
Many thanks
|
|
|
|
|
|
Thanks mate! Looks good..
|
|
|
|
|
And thanks for linking me to the site.. Unfortunately, it doesn't help me as I'm playing the file from an embedded object as a stream.. Thanks anyways pal!
|
|
|
|
|
You could copy it to a temp file though
|
|
|
|
|
harold aptroot wrote: You could copy it to a temp file though
I thought so.. I think I'll have to do it this way, thanks Harold!
|
|
|
|
|
|
I want send for exampel message from one Client to server and server send that message to another Client how I must do it?!
my server project just can send that message to client that send message!!!
|
|
|
|
|
Socket implementation - see here[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
I have a class which reads mails from an OWA(OutlookWebAccess)mail box. I am using the following code as follows, but not sure how will I get the attachment and read those attachemnt.
"SELECT" & _
" ""DAV:href""" & _
",""urn:schemas:httpmail:sendername""" & _
",""urn:schemas:httpmail:subject""" & _
",""urn:schemas:httpmail:datereceived""" & _
",""urn:schemas:httpmail:read""" & _
",""urn:schemas:httpmail:htmldescription""" & _
",""urn:schemas:httpmail:hasattachment""" & _
",""urn:schemas:httpmail:attachmentfilename""" & _
" FROM scope
Even saving the attachment and reading the file thereafter from local folder is also fine. But I don't know how to do the same. Can anybody provide any help for that?
I read something that relates to this in this link. But not able to understand anything. Is this is the way to achieve this?
Please help.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
|
Every .NET (and indeed windows) application can have arguments - see the "args" parameter to your "main" method.
When your external app starts your console app. it can provide the parameters as part of the command line.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
|
You are joking, aren't you?
He said, having a horrible feeling you aren't
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
As he deleted the original posts, we'll never know.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
The last message he delete was "Yes i am..."
Which I think translates into "no, i really am that in-experienced..." Four years he's been here, and claims to be a senior software developer - it make you wonder where he got his educational certificates!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Boxtops my friend. Eat enough Progammer Os and Developer Flakes and for just postage and handling you can be certified in software engineering.
|
|
|
|
|
I thought it was only Driving Licenses you could get from a Christmas cracker!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
@OriginalGriff: Dont be jealous.
Also show the previous posts...
The thing is you don't know the answer and I am done with my task.
|
|
|
|
|
But you apparently know the answer - instead of sharing you deleted the question so now we have this pointless thread on the forum.
If you hadn't deleted the question and had posted the solution you found then many others in the future may have benefited. This is what the CodeProject community is all about.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
I have a .NET project (written in C#) that is a plug-in for Outlook. For this to work, I need VSTO installed on the machine. This is why I would like VSTO to be a prerequisite to my Setup, but it's not listed. Help, anyone?
Thanks in advance.
|
|
|
|
|
i have encountered this error in my program, i don't know how to solve it
pls can someone help.
Error 1 The type 'Sosinpw.SheetStatus' exists in both 'd:\projects\necoscan\necoscan\obj\Debug\Interop.Sosinpw.dll' and 'c:\Program Files\DRS\SKW\Interop.Sosinpw.dll'
thank you.
|
|
|
|
|
It looks like you are trying to include two versions of the same library into your project. Remove the one that you do not need.
It's time for a new signature.
|
|
|
|