|
Thanks Dave
DaveyM69 wrote: This is the correct behaviour. As the parent menu item isn't visible, it is impossible for the child to be visible therefore setting the Visible property has no effect.
The parent menu item is visible.
If I get the value of any top level menu item it returns the correct value i.e True if set to Visible = True;
Whereas the lower menu levels return False even if set to True. (Even if the parent menu item is Visible)
It looks to me like a subitem returns false because it is not visible until the menu drops down from the parent.
Is this normal behaviour? Is the system changing the Visibility property temporarily until the menuitem drops down and is visible? (if the Parent is visible and even if subitem.Visibilty = true)
Lew
|
|
|
|
|
Ah! Now I understand.
The Visible property returns whether it's actually being displayed right now. This should IMO be read-only in this case as setting it actually sets another property instead!
Check out the Available[^] property which behaves exactly as you want.
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)
|
|
|
|
|
Thanks again Dave,
The documentation for Available actually explains Visible better than the Visible Docs.
I thought that it must have been working correctly, (in an odd way). Just couldn't see it in the documentation.
Thanks
Lew
|
|
|
|
|
I have a project coming up (unpaid) indexing newsletters for a Gardening group I am a member of.
The newsletters are in PDF format. As I dabble in c# I thought I may be able to automate the process somewhat.
There appears to be a lot of c# pdf stuff out there to generate and manipulate .pdf docs.
Based on your experience I'm hoping to shorten the process of finding the right solution.
My initial needs are fairly simple....
1) Open an unprotected pdf document.
2) Browse the document.
2) Double click (or select somehow) different selected words.
(this should then highlight every instance of each selected word throughout the document as a visual cue it has been selected already)
3) Generate an index showing A) the selected word and B) the page number(s)
I have a lot of documents to process and they will continue to be ongoing so any help would be great.
|
|
|
|
|
i need to make a drag and drop operation between 2 labels.
in the dragdrop event of the destination i'm able to get the text from the source using
e.Data.GetData(DataFormats.Text)
My problem is that i need the rest of the properties from my source label. How do i get this?
thanks for your time
|
|
|
|
|
Every D&D operation will transfer a DataObject with a format of your choice; if you choose DataFormats.Text, then all you can transfer is a string, which could be the label's text, its name, whatever you choose; you could even serialize the whole label in the one string.
You could also create your own DataFormat; that of course only makes sense if you are involved in the definition of both the source and the destination app involved in the D$D (assuming your D$D is inter-app). If all you are doing is making an intra-app D&D, then you could still do that, however if so you don't really need D&D at all, as you could just handle the mouse events and clone the Control involved.
|
|
|
|
|
I'm using the WeatherBug API to retrieve weather data. Unfortunately there are no good examples or documentation for C# to help me with this. What I do know is that I'm making a SOAP call, receiving a SOAP response, which contains XML in an object of type GetLiveCompactWeatherByUSZipCodeResponse.
My question is: How can I get that soap response and get the XML? I know how to manipulate the XML but how do I get to it when it comes back as a type called GetLiveCompactWeatherByUSZipCodeResponse?
I'm calling this URL: http://api.wxbug.net/webservice-v1.asmx?op=GetLiveCompactWeatherByUSZipCode[^]
My code is:
WeatherBugWebServicesSoapClient proxy = new WeatherBugWebServicesSoapClient("WeatherBugWebServicesSoap");
result = proxy.GetLiveCompactWeatherByUSZipCode("52722", api.wxbug.net.UnitType.English, "xxxxxxxxxx");
result is a string (just to get the raw xml for now). When I do this the red line says: Cannot implicitly convert type api.wxbug.net.LiveCompactWeatherData to string.
Any help is much appreciated.
|
|
|
|
|
Hi,
Does anybody know of a good example of using variables between multiple forms.
I am in need of one as I could do it and now I can't (get, set and the rest!)
Glenn
|
|
|
|
|
Maybe you could start here[^]
|
|
|
|
|
Great, thanks for that. But I'm looking for a way that Form1 can call up Form2, Form2 then has data that is passed back to Form1. Most of the methods I (yours included) Form1 passes the data to Form2 and not the other way I was looking at trying to alterone your methods to that but have come unstuck, is Properties approach the way to go or not and what is the overhead? All I'm think of doing is inputting three ints and away.
Glenn
|
|
|
|
|
Instead of doing it that way, you could just setup a static object that contains your data, and use that object in all of the forms. That way, when one form sets the data, the other form can read it, and change it as well.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
If you use ShowDialog to display Form2 then after it has closed all the properties of Form2 are available to you until the instance is disposed, or goes out of scope.
|
|
|
|
|
|
Have a look at my tip[^] then my article[^] for a more complete tutorial.
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)
|
|
|
|
|
DaveyM69 wrote: then my article[^] for a more complete tutorial
Had reason to use this recently, a very helpful article from a helpful guy.
Thanks again Dave!
|
|
|
|
|
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)
|
|
|
|
|
Hi,
Thanks for that it works one way Form1 to Form2, I am trying to get Form2 to Form1 (Don't ask Tower of Babel situation). Now I am trying the method for Form1 to Form2 reversed and running into problems. Very unpolitical correct give me Global variables back I promise not to abuse them !(like I did)
Glenn
|
|
|
|
|
Sounds similar to what I wanted to do. Form2 needed to set a menuitem on Form1.
this was done by creating the event in Form2 registering the handler in Form1.
Form 2 also needed to know the status of some menuitems in Form1.
This was done by creating the event in Form2 with and registering the handler in Form1.
This handler sets one of the custom eventargs properties and returns them to Form2.
It was a combination of Daves examples.
I'm sure DaveyM69 will explain it more succintly!
Thread of my question is Here may help.
|
|
|
|
|
|
Hi, sorry for the delay in getting back. I'm having a busy day at work
It seems AussieLew has guided you through. If you need any more help feel free to post back and I will have a look tonight (UK) if you are stuck or unsure.
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)
|
|
|
|
|
He has helped but I still need a little guidance as it all seems to be forward and not backward passing.
Thanks Glenn
|
|
|
|
|
glennPattonWork wrote: all seems to be forward and not backward passing
No. Have a look at this exmple that does exactly what you want. Anything you don't understand, just ask!
using System;
public delegate void ThreeIntsEventHandler(object sender, ThreeIntsEventArgs e);
public class ThreeIntsEventArgs : EventArgs
{
private int x;
private int y;
private int z;
public ThreeIntsEventArgs(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
public int X
{
get { return x; }
}
public int Y
{
get { return y; }
}
public int Z
{
get { return z; }
}
}
using System.Drawing;
using System.Windows.Forms;
public partial class FormChild : Form
{
public event ThreeIntsEventHandler ThreeInts;
private NumericUpDown numericUpDownX;
private NumericUpDown numericUpDownY;
private NumericUpDown numericUpDownZ;
private Button buttonOK;
public FormChild()
{
InitializeComponent();
numericUpDownX = new NumericUpDown();
numericUpDownX.Location = new Point(12, 12);
numericUpDownY = new NumericUpDown();
numericUpDownY.Location = new Point(12, 36);
numericUpDownZ = new NumericUpDown();
numericUpDownZ.Location = new Point(12, 60);
buttonOK = new Button();
buttonOK.Text = "OK";
buttonOK.Location = new Point(12, 84);
buttonOK.Click += new System.EventHandler(buttonOK_Click);
Controls.AddRange(new Control[] { numericUpDownX, numericUpDownY, numericUpDownZ, buttonOK });
AcceptButton = buttonOK;
}
private void buttonOK_Click(object sender, System.EventArgs e)
{
OnThreeInts(new ThreeIntsEventArgs((int)numericUpDownX.Value, (int)numericUpDownY.Value, (int)numericUpDownZ.Value));
}
protected virtual void OnThreeInts(ThreeIntsEventArgs e)
{
ThreeIntsEventHandler eh = ThreeInts;
if (eh != null)
eh(this, e);
}
}
using System.Windows.Forms;
public partial class FormParent : Form
{
public FormParent()
{
InitializeComponent();
Click += new System.EventHandler(FormParent_Click);
}
private void FormParent_Click(object sender, System.EventArgs e)
{
FormChild formChild = new FormChild();
formChild.ThreeInts += new ThreeIntsEventHandler(formChild_ThreeInts);
formChild.Show();
}
private void formChild_ThreeInts(object sender, ThreeIntsEventArgs e)
{
MessageBox.Show(string.Format("X: {0}, Y: {1}, Z:{2}", e.X, e.Y, e.Z));
}
}
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)
|
|
|
|
|
Hi,
I have had a fiddle it seems a little over compliated at the moment. I have a simpler method using the Panel component with three text boxe sand a button click to make the panel visible, once the variables are entered the panel is made invisible the values can be recorded. What the opinion of that? I have tried in a demo App does look too bad.
Glenn
|
|
|
|
|
If it works for you then cool
I don't see how that helps you get values from one form to another though
I'm planning another article that will be a bit more light hearted so more accessible on various OOP techniques/patterns including events/delegates (Observer Pattern). I'll post here when it's published, which will probably be a couple of weeks, as you may find it useful.
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)
|
|
|
|
|
So you (and others) can see how simple events really are to create, I have posted a simple tip here[^].
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)
|
|
|
|